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 mhammond
Recipients mhammond
Date 2008-09-30.13:20:29
SpamBayes Score 4.7299733e-07
Marked as misclassified No
Message-id <1222780832.06.0.913683232517.issue4001@psf.upfronthosting.co.za>
In-reply-to
Content
Create an empty directory with only 2 files, foo.py and bar.py, both
exactly 1 line:

foo.py:
|from bar import bar
bar.py:
|bar = "bar"

Running 2to3 results in the following patch for foo.py:
-from bar import bar
+from .bar import bar

However, the resulting foo.py fails to run - the 2 files are not in a
package, so we get:

| ValueError: Attempted relative import in non-package

Attaching a patch which checks there is an __init__.py in the same
directory as the files before it considers it a potential relative import.
History
Date User Action Args
2008-09-30 13:20:32mhammondsetrecipients: + mhammond
2008-09-30 13:20:32mhammondsetmessageid: <1222780832.06.0.913683232517.issue4001@psf.upfronthosting.co.za>
2008-09-30 13:20:30mhammondlinkissue4001 messages
2008-09-30 13:20:30mhammondcreate