[Ironpython-users] Latest status on ctypes?

Jeff Hardy jdhardy at gmail.com
Tue Mar 5 21:41:30 CET 2013


On Tue, Mar 5, 2013 at 6:12 AM, Doug Blank <doug.blank at gmail.com> wrote:
> Looks like there are at least two issues: one where the platform is
> not known (and doesn't know what low level library to open), but the
> lower level issue seems to be:
>
> $ mono ./ipy64.exe
> IronPython 2.7.3 (2.7.0.40) on Mono 4.0.30319.1 (64-bit)
> Type "help", "copyright", "credits" or "license" for more information.
>>>> from ctypes import dlopen
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
>   File "/home/dblank/Desktop/IronPython-2.7.3/Lib/ctypes/__init__.py",
> line 441, in <module>
>   File "/home/dblank/Desktop/IronPython-2.7.3/Lib/ctypes/__init__.py",
> line 353, in __init__
> OSError: IronPython.Runtime.Exceptions.OSException: cannot load library
>   at IronPython.Modules.CTypes.LoadLibrary (System.String library,
> Int32 mode) [0x00000] in <filename unknown>:0
>   at IronPython.Modules.CTypes.dlopen (System.String library, Int32
> mode) [0x00000] in <filename unknown>:0
>   at Microsoft.Scripting.Interpreter.FuncCallInstruction`3[System.String,System.Int32,System.Object].Run
> (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in
> <filename unknown>:0
>   at Microsoft.Scripting.Interpreter.Interpreter.Run
> (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in
> <filename unknown>:0
>>>> from _ctypes import dlopen
>>>> dlopen("/usr/lib/libpython2.7.so")
> Traceback (most recent call last):
>   File "<stdin>", line 1, in <module>
> OSError: IronPython.Runtime.Exceptions.OSException: cannot load
> library /usr/lib/libpython2.7.so
>   at IronPython.Modules.CTypes.LoadLibrary (System.String library,
> Int32 mode) [0x00000] in <filename unknown>:0
>   at IronPython.Modules.CTypes.dlopen (System.String library, Int32
> mode) [0x00000] in <filename unknown>:0
>   at Microsoft.Scripting.Interpreter.FuncCallInstruction`3[System.String,System.Int32,System.Object].Run
> (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in
> <filename unknown>:0
>   at Microsoft.Scripting.Interpreter.Interpreter.Run
> (Microsoft.Scripting.Interpreter.InterpretedFrame frame) [0x00000] in
> <filename unknown>:0
>
> libpython2.7.so does exist, but LoadLibrary doesn't appear to be able
> to deal with it. Am I using this correctly?

It shouldn't even be trying to load libpython, since IronPython won't
be able to do anything sensible with it. That said, it should still
load, but I have no idea why it's not. Which OS are you using? And
which version of Mono?

- Jeff


More information about the Ironpython-users mailing list