VS2010 launch error: Object reference not set to an instance of an object.

Feb 10, 2012 at 12:47 AM

I've installed ActivePython's 2.7 distribution.  I have VS2010 Pro.  I get an error when I launch VS that the Python Tools Package did not load correctly.  Inspecting the error log from VS shows the output below.  Anyone have any idea why it would struggle to find a default CPythonInterpreter?  I tried installing CPython and IronPython but that didn't help.  

 

<errorinfo>

The composition produced a single composition error. The root cause is provided below. Review the CompositionException.Errors property for more detailed information.

 

1) Object reference not set to an instance of an object.

 Resulting in: An exception occurred while trying to create an instance of type 'Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider'.

 Resulting in: Cannot activate part 'Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider'.

Element: Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider -->  Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider

 

Resulting in: Cannot get export 'Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider (ContractName="Microsoft.PythonTools.Interpreter.Default.IDefaultInterpreterFactoryCreator")' from part 'Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider'.

Element: Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider (ContractName="Microsoft.PythonTools.Interpreter.Default.IDefaultInterpreterFactoryCreator") -->  Microsoft.PythonTools.Interpreter.Default.CPythonInterpreterFactoryProvider

 

Resulting in: Cannot set import 'Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider..ctor (Parameter="defaultCreator", ContractName="Microsoft.PythonTools.Interpreter.Default.IDefaultInterpreterFactoryCreator")' on part 'Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider'.

Element: Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider..ctor (Parameter="defaultCreator", ContractName="Microsoft.PythonTools.Interpreter.Default.IDefaultInterpreterFactoryCreator") -->  Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider

 

Resulting in: Cannot get export 'Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider (ContractName="Microsoft.PythonTools.Interpreter.IPythonInterpreterFactoryProvider")' from part 'Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider'.

Element: Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider (ContractName="Microsoft.PythonTools.Interpreter.IPythonInterpreterFactoryProvider") -->  Microsoft.PythonTools.ConfigurablePythonInterpreterFactoryProvider

</errorinfo>

Coordinator
Feb 10, 2012 at 1:01 AM

Can you look in the registry at HKLM\Software\Python\PythonCore\<version>\InstallPath and see if the default value is set?  That's the only thing that I could see that would cause this to break (you might also need to look in HKLM\Software\Wow6432Node\Python\PythonCore as well as HKCU\Software\Python\PythonCore).

If that's not set then setting it to where you installed Python to should fix it, but we should be more resilient here.

Feb 10, 2012 at 1:27 AM
Edited Feb 10, 2012 at 1:34 AM

Thanks for the quick reply.  Firstly I should mention I'm on Win7 x64.  Before I installed ActivePython 2.7 I already had a Python distribution on my machine (2.6).

Default is set correctly in HKLM\Software\Python\PythonCore\2.7\InstallPath however:

HKLM\Software\Wow6432Node\python\pythoncore seems wrong.  pythoncore\2.6\InstallPath has no default value and pythoncore\2.7\ doesn't even have InstallPath or PythonPath keys.

HKCU\Software\... doesn't have a Python directory at all.

That did it!  I added an InstallPath key to pythoncore\2.7\ and set it's default value.  I also updated the Default value for the 2.6 InstallPath key.  I was still crashing after I fixed the 2.6 installPath but after I added the 2.7 InstallPath key everything works great.  Also I'm now able to select which interpreter I want to use in VSTools options and all the paths seem correct in there.

Thanks for the direction

Coordinator
Feb 10, 2012 at 1:30 AM

Glad that fixed it.  I'll make it so we ignore installations that don't have install paths in the future.