[IronPython] Patching __import__ can break .NET attribute access

Michael Foord fuzzyman at voidspace.org.uk
Fri Mar 6 15:40:44 CET 2009


Hello all,
If you patch __builtin__.__import__, even with something that delegates 
to the real __import__, then accessing .NET attributes can break.

Attached are two Python files, place them in the same directory and run:

    ipy first.py

and get this error:

Traceback (most recent call last):
  File "first.py", line 12, in first.py
  File "C:\buildshare\test.py", line 6, in function
AttributeError: 'int' object has no attribute 'MaxValue'

All it does is patch __import__ so that all imports are printed.

This is with Python 2.0.1.

All the best,

Michael
--
http://www.ironpythoninaction.com/


-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: first.py
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090306/4ee5af05/attachment.ksh>
-------------- next part --------------
An embedded and charset-unspecified text was scrubbed...
Name: test.py
URL: <http://mail.python.org/pipermail/ironpython-users/attachments/20090306/4ee5af05/attachment-0001.ksh>


More information about the Ironpython-users mailing list