[Python.NET] path question: clr.so being picky about paths

Link, Hamilton helink at sandia.gov
Wed Dec 3 07:17:57 CET 2008

I'll go back and look again, but as far as I could tell from the .il code and the .c code for clr.pyd and clr.so...

- clr.so bootstraps mono (under Windows the OS knows how to dlload a .net assembly already) to enable .net assembly extensions and I assumed perhaps recklessly that it laterals to clr.pyd
- clr.pyd loads Python.Runtime.dll
- Python.Runtime.dll, regardless of platform, turns around and uses P/Invoke to connect into the libpython2.5.so/dll, and then you're all set

Maybe a dev can confirm or correct me on this, and elaborate a bit?  I can certainly try setting aside clr.pyd and I'll keep studying the code, but I guess I didn't notice if clr.so knew to find Python.Runtime.dll after it set up mono.

From: Joe Frayne [Jfrayne at blizzard.com]
Sent: Tuesday, December 02, 2008 7:08 PM
To: Link, Hamilton; pythondotnet at python.org
Subject: RE: [Python.NET] path question: clr.so being picky about paths

I got it working on MacOSX under Mono. I'm pretty sure the clr.pyd is only for Windows. I think you just need the Python.Runtime.dll, the Python.Runtime.dll.config, and the clr.so in the site-packages folder.


-----Original Message-----
From: pythondotnet-bounces+jfrayne=blizzard.com at python.org [mailto:pythondotnet-bounces+jfrayne=blizzard.com at python.org] On Behalf Of Hamilton Link
Sent: Tuesday, December 02, 2008 5:19 PM
To: pythondotnet at python.org
Subject: [Python.NET] path question: clr.so being picky about paths

In the readme, it says that "python for .net uses the pythonpath
(sys.path) to look for assemblies to load, in addition to the usual
application base and the gac.

Unfortunately at the moment the assembly I'm trying to load is... clr.pyd.

If I run python (ubuntu, mono, rebuilt python 2.5.2 with
--enable-shared) from a directory where clr.pyd and Python.Runtime.dll
reside, with clr.so in the lib/python2.5/site-packages folder...
everything works.  I can import clr and System.Drawing and make a
System.Drawing.Point instance.

If I run python from a directory without these libraries, in particular
if I'm in my home folder somewhere and clr.pyd and Python.Runtime.dll
are in the lib/python2.5/site-packages folder where I want them...
import clr gives me an error trying to load some unspecified module (I
suspect clr.pyd).

Am I supposed to set some path or other for mono in contravention of the
docs?  I suspect that either clr.so can't find mono, or mono is being
loaded and then can't find clr.pyd.

I will continue to fiddle with this, probably Friday, if I don't get a
response, but it seems like there's probably a simple answer that I'm
overlooking.  Setting MONO_PATH to my site-packages folder (the variable
was unbound before) didn't fix it.


Python.NET mailing list - PythonDotNet at python.org

More information about the PythonDotNet mailing list