IronPython Script works in Eclipse but causes error in VS 2012 + PTVS 2012

Mar 13, 2013 at 12:04 PM
Hi,

i just tried to ran an IronPython script, which works fine in Eclipse in VS2012 + PTVS 2012. And I got the following error messages:

'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\mscorlib\v4.0_4.0.0.0__b77a5c561934e089\mscorlib.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\ipy.exe', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Dynamic\v4.0_1.1.0.20__7f709c5b713576e1\Microsoft.Dynamic.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Core\v4.0_4.0.0.0__b77a5c561934e089\System.Core.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System\v4.0_4.0.0.0__b77a5c561934e089\System.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\Microsoft.Scripting\v4.0_1.1.0.20__7f709c5b713576e1\Microsoft.Scripting.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Configuration\v4.0_4.0.0.0__b03f5f7f11d50a3a\System.Configuration.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Xml\v4.0_4.0.0.0__b77a5c561934e089\System.Xml.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\IronPython\v4.0_2.7.0.40__7f709c5b713576e1\IronPython.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\IronPython.Modules\v4.0_2.7.0.40__7f709c5b713576e1\IronPython.Modules.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\System.Numerics\v4.0_4.0.0.0__b77a5c561934e089\System.Numerics.dll', Skipped loading symbols. Module is optimized and the debugger option 'Just My Code' is enabled.
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\cluster.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\fftpack_lite.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\integrate.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.SQLite.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\IronPython.Wpf.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\lapack_lite.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_MSIL\mscorlib.resources\v4.0_4.0.0.0_de_b77a5c561934e089\mscorlib.resources.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\linalg.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\mtrand.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\ndimage.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\NumpyDotNet.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\odr.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\optimize.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\signal.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\special.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Program Files (x86)\IronPython 2.7\DLLs\stats.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.debug.scripting'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'C:\Windows\Microsoft.Net\assembly\GAC_32\ISymWrapper\v4.0_4.0.0.0__b03f5f7f11d50a3a\ISymWrapper.dll'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'Snippets.scripting'
'ipy.exe' (Managed (v4.0.30319)): Loaded 'Anonymously Hosted DynamicMethods Assembly'
A first chance exception of type 'IronPython.Runtime.Exceptions.ImportException' occurred in IronPython.dll
A first chance exception of type 'IronPython.Runtime.UnboundNameException' occurred in IronPython.dll
The program '[1340] ipy.exe: Managed (v4.0.30319)' has exited with code 0 (0x0).
Coordinator
Mar 13, 2013 at 5:39 PM
There appears to be an import exception, and then some global variable is undefined when it's being accessed. I would suggest changing the debugging mode from .NET debugging to Python debugging by right clicking on the project in Solution Explorer, going to Properties, going to the Debug page, and then changing the launcher mode. This will give you a much nicer Python debugging experience at the expense of not being able to step into C# and other .NET code.

If you then re-run you'll see a much more clear Python exception. You may also need to go to Debug->Exceptions and enable breaking on Python exceptions to see it.