import failure with IronPython

Bug #571020 reported by Loren Guthrie
16
This bug affects 2 people
Affects Status Importance Assigned to Milestone
DreamPie
Fix Released
Undecided
Unassigned

Bug Description

Problem: Imports fail with IronPython for subpackages or mapped drives

Steps to Reproduce:
1. Install IronPython, configure DreamPie shortcut with
"C:\Program Files\DreamPie\dreampie.exe" --hide-console-window "C:\Program Files\IronPython 2.6\ipy.exe"
2. Launch DreamPie
3. Import any file or package not in the Lib directory
"""
IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3607
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.0.2
>>> import xml.etree
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    import xml.etree
  File "C:\Program Files\DreamPie\share\dreampie\py_zipimport.py", line 97, in __init__
    raise ZipImportError(msg)
ZipImportError: Non-file 'C:\\Program Files\\IronPython 2.6\\Lib\\xml' found for 'C:\\Program Files\\IronPython 2.6\\Lib\\xml'
>>> import sys
>>> sys.path_hooks
0: [<class py_zipimport.zipimporter at 0x000000000000002C>]
"""

Comments:
C:\Program Files\DreamPie\share\dreampie\subp_main.py says:
"""
if sys.platform == 'cli':
    # IronPython doesn't have built-in zipimport.
    import py_zipimport
"""
It looks like this version of py_zipimport is intercepting imports, then failing on imports that are not from zip files.

Revision history for this message
Loren Guthrie (lguthrie) wrote :

A workaround is to clear sys.path_hooks:
"""
IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3607
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.0.2
>>> from xml.etree import ElementTree
Traceback (most recent call last):
  File "<pyshell#0>", line 1, in <module>
    from xml.etree import ElementTree
  File "C:\Program Files\DreamPie\share\dreampie\py_zipimport.py", line 97, in __init__
    raise ZipImportError(msg)
ZipImportError: Non-file 'C:\\Program Files\\IronPython 2.6\\Lib\\xml' found for 'C:\\Program Files\\IronPython 2.6\\Lib\\xml'
>>> import sys; sys.path_hooks=[]
>>> from xml.etree import ElementTree
>>> ElementTree
0: <module 'xml.etree.ElementTree' from 'C:\Program Files\IronPython 2.6\Lib\xml\etree\ElementTree.py'>
"""

Revision history for this message
Loren Guthrie (lguthrie) wrote :

This appears to be fixed in release 1.0.3:

IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3607
Type "copyright", "credits" or "license()" for more information.
DreamPie 1.0.3
>>> import xml.etree
>>> import sys;sys.path_hooks
0: []

Changed in dreampie:
status: New → Fix Released
Revision history for this message
Noam Yorav-Raphael (noamraph) wrote : Re: [Bug 571020] Re: import failure with IronPython

Great!

I commited a fix and forgot to close the bug, so I'm happy to hear
that it works.

Noam

On Fri, Jun 25, 2010 at 8:43 PM, Loren Guthrie <email address hidden> wrote:
>
> This appears to be fixed in release 1.0.3:
>
> IronPython 2.6 (2.6.10920.0) on .NET 2.0.50727.3607
> Type "copyright", "credits" or "license()" for more information.
> DreamPie 1.0.3
> >>> import xml.etree
> >>> import sys;sys.path_hooks
> 0: []
>
> ** Changed in: dreampie
>       Status: New => Fix Released
>
> --
> import failure with IronPython
> https://bugs.launchpad.net/bugs/571020
> You received this bug notification because you are subscribed to
> DreamPie.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Duplicates of this bug

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.