[IPython-User] pythonnet and IPython

Christoph Gohlke cgohlke@uci....
Tue Nov 6 11:18:00 CST 2012


On 11/6/2012 2:22 AM, John Burkhart wrote:
> Hello,
>
> I'm trying to use IPython with pythonnet.
>
> I have the following .bat script:
>
> @echo off
> set path="C:\pythonnet\";%path%
> set
> PYTHONPATH="C:\Python27\Lib;C:\Python27\Lib\site-packages;C:\pythonnet\";%pythonpath%
> python.exe -c "import sys; from IPython.frontend.terminal.ipapp import
> launch_new_instance; sys.exit(launch_new_instance())" %*
> exit /B %ERRORLEVEL%
>
> This worked previously on a VM machine running Windows 7, but now I've
> installed it on my actual laptop running Windows 7 and I get the
> traceback pasted below.
>
> What module is it looking for that cannot be found? By the way, IPython
> runs fine when used normally (e.g. without pythonnet python.exe)
>
> Thank you,
> john
>
>
> Windows PowerShell
> Copyright (C) 2009 Microsoft Corporation. All rights reserved.
>
> PS C:\Users\u35888> .\ipythonnet.bat
> Traceback (most recent call last):
>    File "<string>", line 1, in <module>
>    File
> "C:\Python27\Lib\site-packages\IPython\frontend\terminal\ipapp.py", line
> 388, in launch_new_instance
>      app.initialize()
>    File "<string>", line 2, in initialize
>    File "C:\Python27\Lib\site-packages\IPython\config\application.py",
> line 84, in catch_config_error
>      return method(app, *args, **kwargs)
>    File
> "C:\Python27\Lib\site-packages\IPython\frontend\terminal\ipapp.py", line
> 324, in initialize
>      self.init_shell()
>    File
> "C:\Python27\Lib\site-packages\IPython\frontend\terminal\ipapp.py", line
> 340, in init_shell
>      ipython_dir=self.ipython_dir)
>    File "C:\Python27\Lib\site-packages\IPython\config\configurable.py",
> line 318, in instance
>      inst = cls(*args, **kwargs)
>    File
> "C:\Python27\Lib\site-packages\IPython\frontend\terminal\interactiveshell.py",
> line 360, in __init__
>      user_module=user_module, custom_exceptions=custom_exceptions
>    File
> "C:\Python27\Lib\site-packages\IPython\core\interactiveshell.py", line
> 454, in __init__
>      self.init_readline()
>    File
> "C:\Python27\Lib\site-packages\IPython\core\interactiveshell.py", line
> 1779, in init_readline
>      import IPython.utils.rlineimpl as readline
>    File "C:\Python27\Lib\site-packages\IPython\utils\rlineimpl.py", line
> 33, in <module>
>      from readline import *
>    File "C:\Python27\Lib\site-packages\readline.py", line 5, in <module>
>      from pyreadline.rlmain import Readline
>    File "C:\Python27\Lib\site-packages\pyreadline\__init__.py", line 9,
> in <module>
>      import unicode_helper, logger, clipboard, lineeditor, modes, console
>    File "C:\Python27\Lib\site-packages\pyreadline\console\__init__.py",
> line 14, in <module>
>      from console import *
>    File "C:\Python27\Lib\site-packages\pyreadline\console\console.py",
> line 605, in <module>
>      msvcrt = cdll.LoadLibrary(ctypes.util.find_msvcrt())
>    File "C:\Python27\Lib\ctypes\__init__.py", line 443, in LoadLibrary
>      return self._dlltype(name)
>    File "C:\Python27\Lib\ctypes\__init__.py", line 365, in __init__
>      self._handle = _dlopen(self._name, mode)
> WindowsError: [Error 126] The specified module could not be found
>
> If you suspect this is an IPython bug, please report it at:
> https://github.com/ipython/ipython/issues
> or send an email to the mailing list at ipython-dev@scipy.org
> <mailto:ipython-dev@scipy.org>
>
> You can print a more detailed traceback right now with "%tb", or use
> "%debug"
> to interactively debug it.
>
> Extra-detailed tracebacks for bug-reporting purposes can be enabled via:
>      c.Application.verbose_crash=True
>
>
>

Since you are not building the executable with Visual Studio 2008, you 
should separately embed the msvcr90 manifest (attached for 64 bit) into 
the executable (pythonnet's python.exe):

mt.exe -outputresource:python.exe;#1 -manifest msvcr90.manifest

mt.exe is part of the Windows SDK AFAIK.

Try not to run `python.exe -c ""` with pythonnet; it always crashes for 
me. Could be a bug in pythonnet.

Christoph
-------------- next part --------------
<assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0">
  <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3">
    <security>
      <requestedPrivileges>
        <requestedExecutionLevel level="asInvoker" uiAccess="false"></requestedExecutionLevel>
      </requestedPrivileges>
    </security>
  </trustInfo>
  <dependency>
    <dependentAssembly>
      <assemblyIdentity type="win32" name="Microsoft.VC90.CRT" version="9.0.21022.8" processorArchitecture="amd64" publicKeyToken="1fc8b3b9a1e18e3b"></assemblyIdentity>
    </dependentAssembly>
  </dependency>
</assembly>


More information about the IPython-User mailing list