Home > Uncategorized > Debugging a chocolatey command

Debugging a chocolatey command

Debugging a chocolatey operation is easy.

```>chocolatey -debug install easy_install -source python
DEBUG: Running 'Chocolatey-Install' for easy_install with source: 'python', version: '', installerArguments:''
DEBUG: Running 'Chocolatey-Python' for easy_install with version:'', installerArguments: ''
DEBUG: Running 'Chocolatey-InstallIfMissing' for python with source:'', version: ''
DEBUG: Running 'Chocolatey-InstallIfMissing' for easy.install with source:'', version: ''
DEBUG: Running 'Chocolatey-Version' for easy.install with source:''.
DEBUG: Running 'Get-ConfigValue' with configValue:'useNuGetForSources'
DEBUG: Running 'Get-UserConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the user config the value of 'useNuGetForSources' is ''
DEBUG: Value not found in the user config file - checking the global config
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the global config the value of 'useNuGetForSources' is 'false'
DEBUG: Running 'Get-UserConfigValue' with configValue:'sources'
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'sources'
DEBUG: Using global sources
DEBUG: Calling 'C:\Chocolatey\chocolateyinstall\nuget.exe' list "easy.install" -Source "http://chocolatey.org/api/v2/" -Source
DEBUG: easy.install 0.6.11.4
DEBUG: "Sort-Object" - "python" cannot be found in "InputObject".
DEBUG: Long version of 0.6.11.4 is '000000000000.000000000006.000000000011.000000000004'
DEBUG: Running 'Chocolatey-NuGet' for easy.install with source:''. Force? False
Chocolatey (v0.9.8.20) is installing easy.install and dependencies. By installing you accept the license for easy.install and each dependency you are installing.
DEBUG: Installing packages to "C:\Chocolatey\lib".
DEBUG: Running 'Run-NuGet' for easy.install with source: '', version:''
DEBUG: ___ NuGet ____
DEBUG: Running 'Get-ConfigValue' with configValue:'useNuGetForSources'
DEBUG: Running 'Get-UserConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the user config the value of 'useNuGetForSources' is ''
DEBUG: Value not found in the user config file - checking the global config
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'useNuGetForSources'
DEBUG: After checking the global config the value of 'useNuGetForSources' is 'false'
DEBUG: Running 'Get-UserConfigValue' with configValue:'sources'
DEBUG: Running 'Get-GlobalConfigValue' with configValue:'sources'
DEBUG: Using global sources
DEBUG: Calling 'C:\Chocolatey\chocolateyinstall\nuget.exe' install easy.install -Outputdirectory "C:\Chocolatey\lib" -Source
DEBUG: Installing 'easy.install 0.6.11.4'.
Successfully installed 'easy.install 0.6.11.4'.
DEBUG: Evaluating NuGet output for line: Installing 'easy.install 0.6.11.4'.
______ easy.install v0.6.11.4 ______
DEBUG: Running 'Delete-ExistingErrorLog' for easy.install
DEBUG: Looking for failure log at 'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\failure.log'
DEBUG: Found the failure log. Deleting it...
DEBUG: Running 'Run-ChocolateyPS1' for easy.install with packageFolder:'C:\Chocolatey\lib\easy.install.0.6.11.4', action: 'install'
DEBUG:   __ PowerShell install (chocolateyinstall.ps1) __
DEBUG:   Looking for chocolateyinstall.ps1 in folder 'C:\Chocolatey\lib\easy.install.0.6.11.4'. If chocolateyinstall.ps1 is found, it
will be run.
DEBUG: Action file is 'chocolateyInstall.ps1'
DEBUG: Running 'C:\Chocolatey\lib\easy.install.0.6.11.4\tools\chocolateyInstall.ps1'
DEBUG: Running 'Install-ChocolateyPath' with pathToInstall:'C:\Python27'
DEBUG: Running 'Install-ChocolateyPath' with pathToInstall:'C:\Python27\Scripts'
Setting PYTHONHOME environment variable to 'C:\Python27'
PS: PYTHONHOME variable is not required to Python works, but it is a good practice to have it.
Using python home at 'C:\Python27'
Installing easy_install for Python(2.7.5)...
Installing setuptools from http://pypi.python.org/pypi/setuptools ...
DEBUG: Running 'Install-ChocolateyPackage' for easy.install/setuptools with
url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe', args: '/S'
DEBUG: Running 'Get-ChocolateyWebFile' for easy.install/setuptools with
url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe',
fileFullPath:'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe',and
url64bit:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe'
DEBUG: Processor width is 64.
DEBUG: Running 'Get-WebFile' for C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe
with url:'http://pypi.python.org/packages/2.7/s/setuptools/setuptools-0.6c11.win32-py2.7.exe', userAgent: 'chocolatey command line'
DEBUG: Setting the UserAgent to 'chocolatey command line'
Write-Error : easy.install/setuptools did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\Users\Matt\AppData\Local\Temp\chocolatey\e
asy.install\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\Chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:29 char:2
+     Write-Error \$errorMessage
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

Write-Error : easy.install did not finish successfully. Boo to the chocolatey gods!
-----------------------
[ERROR] Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path 'C:\Users\Matt\AppData\Local\Temp\chocolatey\e
asy.install\setuptools\easy.install\setuptoolsInstall.exe'."
-----------------------
At C:\Chocolatey\chocolateyinstall\helpers\functions\Write-ChocolateyFailure.ps1:29 char:2
+     Write-Error \$errorMessage
+     ~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : NotSpecified: (:) [Write-Error], WriteErrorException
+ FullyQualifiedErrorId : Microsoft.PowerShell.Commands.WriteErrorException,Write-Error

new-object : Exception calling ".ctor" with "2" argument(s): "Could not find a part of the path
'C:\Users\Matt\AppData\Local\Temp\chocolatey\easy.install\setuptools\easy.install\setuptoolsInstall.exe'."
At C:\Chocolatey\chocolateyinstall\helpers\functions\Get-WebFile.ps1:82 char:18
+        \$writer = new-object System.IO.FileStream \$fileName, "Create"
+                  ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
+ CategoryInfo          : InvalidOperation: (:) [New-Object], MethodInvocationException
+ FullyQualifiedErrorId : ConstructorInvokedThrowException,Microsoft.PowerShell.Commands.NewObjectCommand
```

You can use this on any of the chocolatey commands as the first argument:

```chocolatey -debug install all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug installmissing all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug update all -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug uninstall 7zip
chocolatey -debug search easy_install
chocolatey -debug list -source ""https://www.myget.org/F/mbrownnycbootstrap/""
chocolatey -debug version all -lo
chocolatey -debug webpi
chocolatey -debug windowsfeatures
chocolatey -debug cygwin
chocolatey -debug python
chocolatey -debug gem
chocolatey -debug pack
chocolatey -debug push
chocolatey -debug help
chocolatey -debug sources
```