Made a little bit of progress, but am now back to square one.. :)
Basically, seems that the python embedded in nuke uses UCS4 instead
of UCS2 which is the default when building python. So the python
so's i had were using UCS2 while Nuke's internal python was using
UCS4. I rebuilt python using the --enable-unicode=ucs4 flag, then
rebuilt python.net.
I hit another wall fairly soon, the mono config (dll remap) file
wasn't being initialized, so i would be getting missing msvcrt dll
errors on import clr.
To fix that, i had to uncomment this line in pynetinit.c:
//mono_config_parse(NULL);
However, now i am back to the previous error i had:
Stacktrace:
at (wrapper managed-to-native)
Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00060>
at (wrapper managed-to-native)
Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff>
at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x0006b>
at Python.Runtime.Runtime.Initialize () <0x00433>
at Python.Runtime.PythonEngine.Initialize () <0x00073>
at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr) <0xffffffff>
oh well... anybody managed to get python.net working with UCS4
python?
cheers,
laszlo
On 07/12/2010 7:08 PM, Laszlo Sebo wrote:
A small update. I went back a couple of versions on mono, to see
if that's got anything to do with my problems.
Starting from a clean VM. I simplified the build process a bit as
well.
I managed to get clr.so working fine with python2.5.5 and using
mono2.4.3, when running it using the standalone python
installation.
However, when i try to import clr into an embedded python (like
the one in Nuke5.2 for example), i get the following error:
Stacktrace:
at (wrapper managed-to-native)
Python.Runtime.Runtime.PyInt_FromLong (intptr) <0x00060>
at (wrapper managed-to-native)
Python.Runtime.Runtime.PyInt_FromLong (intptr) <0xffffffff>
at Python.Runtime.Runtime.PyInt_FromInt32 (int) <0x00023>
at Python.Runtime.Runtime.Initialize () <0x00303>
at Python.Runtime.PythonEngine.Initialize () <0x0004b>
at (wrapper runtime-invoke) object.runtime_invoke_void
(object,intptr,intptr,intptr)
<0xffffffff >
Native stacktrace:
/usr/local/lib/libmono.so.0 [0x2aaab409088d]
/usr/local/lib/libmono.so.0 [0x2aaab40c0a33]
/lib64/libc.so.6 [0x39568302d0]
/usr/local/lib/libpython2.5.so(PyInt_FromLong+0x1c)
[0x2aaab48fdf5c]
[0x40fad6a0]
I noticed that Ulrich Elk had this issue about 2 years ago, and
Brian Lloyd's first reaction was "are you on a 64bit machine?".
Well, i am :-)
All the libraries i use are 64b (at least i think so, i built most
requirements myself).
( http://mail.python.org/pipermail/pythondotnet/2008-April/000795.html
)
cheers,
laszlo
On 06/12/2010 5:22 PM, Laszlo Sebo wrote:
Hi there,
I've been trying to get Python.Net working for the last couple
weeks on linux (using rev 110), and so far i haven't had much
luck. Maybe i am using libraries that are not yet supported, so
any help would be appreciated.
I am using centOS 5.5, and python 2.5.1 64bit. I am using the
latest (2.8.1) version of mono.
To get python.net to build, i had to modify a couple of files,
as by default it wouldn't build. First I had to build and
install glib (2.26.1), then do the following:
Add these lines to the setup.py (most likely my glib
installation wasn't doing its setup properly)
kw["include_dirs"].append('/usr/local/include/glib-2.0')
kw["include_dirs"].append('/usr/local/lib/glib-2.0/include')
Then edit the pynetclr.h file and add this line:
#include <gmodule.h>
Then edit the makefile for monoclr:
add include files to PY_CFLAGS variable: -I/usr/local/include/glib-2.0 -I/usr/local/lib/glib-2.0/include
MONO_LIBS = $(shell pkg-config --libs mono-2)
MONO_CFLAGS = $(shell pkg-config --cflags mono-2)
add clrpython.o to clr.so make: -dynamiclib pynetinit.o clrmod.o clrpython.o -o clr.so
remove -lpython from the PY_LIBS listing
After this everything built without errors. However... the
clr.so files don't quite work :)
I get 3 behaviours:
- if i use the clr.so in the root folder: import clr; import
System; => segmentation fault
- if i use the clr.so in the monoclr folder: ImportError:
/usr/local/lib/python2.5/site-packages/clr.so: cannot
dynamically load executable
- if i use the clr.so in the root folder, and also copy the
libpython2.5.so in the site-packages folder: import clr
=> segmentation fault
Not sure what i'm doing wrong to be honest. I'll try to roll
back mono a couple versions, and try that (2.4.3 maybe).
I have a feeling i am missing something very obvious here...
Any pointers would be appreciated!
cheers,
laszlo sebo
|