[Python.NET] Making a true Python package out of Python for .NET

Stephen Granade stephen at granades.com
Thu Dec 12 22:00:33 CET 2013


For a project I'm working on, I'd like to put Python for .NET in a more
standard Python package that lives in site-packages.

However, the bootstrapping that happens in InitExt() in pythonengine.cs
doesn't work in that case. If I put together a package that looks like:

site-packages
    pythonnet
        __init__.py
        clr.pyd
        Python.Runtime.dll

add "from pythonnet" to the lines that the nasty bootstrapping hack looks
for in traceback, then when I call

from pythonnet import clr

Python goes into an infinite recursion loop. The import calls up initclr()
in ClrModule.cs, which calls InitExt() in pythonengine.cs, which calls
Python with the command "from pythonnet import clr", which calls initclr()
in ClrModule.cs, which calls InitExt()....

For whatever reason, this doesn't occur with a straight "import clr", if I
dump clr.pyd and Python.Runtime.dll in my root site-packages directory.

What's going on?
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/pythondotnet/attachments/20131212/4b3fe20d/attachment.html>


More information about the PythonDotNet mailing list