[Python.NET] Problem installing

Brian Lloyd brian at zope.com
Tue Oct 28 14:07:31 EST 2003

> david Powell wrote:
>  >I downloaded the files. I can run the demo in your version of python but
>  >not in my existing version of python 2.3.
> That's to be expected. Your existing python 2.3 doesn't connect
> to dot net.
> That's what Brian's Python does.
> -Amos

Actually, you can connect your existing Python as of beta 1.

There is a subtle issue in that configuration though. We install an
import hook to lazily load CLR namespaces. This works fine if you run
via the managed wrapper, because the import hook is installed before
you actually try to import something.

If you use the new CLR.dll with your existing Python, the act of
importing CLR causes the import hook to be installed. This is also
fine, as long as you do:

  import CLR # installs the hook
  from CLR.System import Something

The problem is when you do just:

  from CLR.System import Something

In this case, the standard Python importer is in control at the
time CLR is imported, so though the hook is installed, this first
import will fail if it tries to import sub-names.

I have a hack in mind that will fix it if need be - ideally I'll
have time to change the current import hook to the new blessed
way of hacking import in 2.3, which may also be a way to fix it.

Brian Lloyd        brian at zope.com
V.P. Engineering   540.361.1716
Zope Corporation   http://www.zope.com

More information about the PythonDotNet mailing list