This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

Author ncoghlan
Recipients
Date 2006-06-30.16:51:54
SpamBayes Score
Marked as misclassified
Message-id
In-reply-to
Content
Logged In: YES 
user_id=1038590

Patch attached that allows relative imports from a main
module to work so long as:
  a. the top level package is either in the current
directory or somewhere else on sys.path; and
  b. the module is executed using -m so Python knows where
it fits in the package hierarchy

So to get the PEP 328 example to work, you'd have to run it as:

$python2.5 -m package.subpackage1.moduleX

The patch relies on a feature added to runpy in rev 47142
(post beta 1). I've added a question to PEP 356 as to how
this should be handled, since we're technically in feature
freeze.

Patch attached directly to the bug report because it's
stupidly early in the morning and I don't feel like dealing
with SF and then copying the patch tracker number here :)
History
Date User Action Args
2007-08-23 14:40:44adminlinkissue1510172 messages
2007-08-23 14:40:44admincreate