[Patches] [ python-Patches-685268 ] imputil must respect __path__ for package submodules

SourceForge.net noreply at sourceforge.net
Tue Feb 13 09:35:39 CET 2007


Patches item #685268, was opened at 2003-02-12 12:51
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=685268&group_id=5470

Please note that this message will contain a full copy of the comment thread,
including the initial issue submission, for this request,
not just the latest update.
Category: Library (Lib)
Group: Python 2.3
>Status: Closed
>Resolution: Accepted
Priority: 5
Private: No
Submitted By: Soeren Fietzke (sfiet)
Assigned to: Nobody/Anonymous (nobody)
Summary: imputil must respect __path__ for package submodules

Initial Comment:
The imputil module does not look at the __path__ 
member of a package to find sub-modules. 
To reproduce, create a package with a submodule, i.e. 
directory structure like this:

p1/
  __init__.py
  sub/
     spam.py

contents of __init__.py:
  import os
  __path__.append(os.path.join(__path__[0], 'sub'))
  import spam

contents of spam.py:
  print 'imported spam'


Doing an "import p1" in a fresh Python session will 
succeed.

However, after loading and installing imputil, it will fail:
import imputil
imputil._test_revamp()
import p1  # <-- will not find module spam



----------------------------------------------------------------------

>Comment By: Martin v. Löwis (loewis)
Date: 2007-02-13 09:35

Message:
Logged In: YES 
user_id=21627
Originator: NO

Thanks for the patch. Committed as r53763 and r53764.

----------------------------------------------------------------------

Comment By: Soeren Fietzke (sfiet)
Date: 2003-02-12 13:52

Message:
Logged In: YES 
user_id=710276

There's no uploaded file!  You have to check the
checkbox labeled "Check to Upload & Attach File"
when you upload a file.

Please try again.

(This is a SourceForge annoyance that we can do
nothing about. :-( )

----------------------------------------------------------------------

Comment By: Soeren Fietzke (sfiet)
Date: 2003-02-12 12:58

Message:
Logged In: YES 
user_id=710276

Oops, spaces were stripped out, so just to clarify: 'sub' 
should be a subdirectory of 'p1' in the above example:
p1/__init__.py
p1/sub/spam.py


----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=305470&aid=685268&group_id=5470


More information about the Patches mailing list