[IronPython] Bug With Packages

Dino Viehland dinov at exchange.microsoft.com
Mon Jun 5 18:25:12 CEST 2006


Thanks for the bug report.  I've filed the bug and we'll work on getting this one fixed for the next release.

-----Original Message-----
From: users-bounces at lists.ironpython.com [mailto:users-bounces at lists.ironpython.com] On Behalf Of Michael Foord
Sent: Saturday, June 03, 2006 8:20 AM
To: Discussion of IronPython
Subject: [IronPython] Bug With Packages

Hello all,

I get a bug when importing names that don't exist from a package.

I created a package directory (called package), and place an empty "__init__.py" file in it.

I then created a file called "module.py", with nothing in it except :

    print "hello"

Below is an IronPython (beta 7) console session using these files :

IronPython 1.0.60523 (Beta) on .NET 2.0.50727.42 Copyright (c) Microsoft Corporation. All rights reserved.
 >>> from package.module import module
hello
 >>> type(module)
<type 'module'>
 >>>

You can see the 'hello' from when the module is imported. It should raise an "ImportError" when trying to import the name module. Instead it returns a "module" object.

Below is the same session in CPython :

Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] on
win32
Type "help", "copyright", "credits" or "license" for more information.
 >>> from package.module import module
hello
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
ImportError: cannot import name module
 >>>

Michael Foord
http://www.voidspace.org.uk/python/index.shtml
http://www.resolversystems.com
_______________________________________________
users mailing list
users at lists.ironpython.com
http://lists.ironpython.com/listinfo.cgi/users-ironpython.com



More information about the Ironpython-users mailing list