New submission from Mark Hammond <[EMAIL PROTECTED]>: 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. ---------- components: 2to3 (2.x to 3.0 conversion tool) files: relative_must_be_package.patch keywords: patch messages: 74075 nosy: mhammond severity: normal status: open title: 2to3 does relative import for modules not in a package. Added file: http://bugs.python.org/file11662/relative_must_be_package.patch _______________________________________ Python tracker <[EMAIL PROTECTED]> <http://bugs.python.org/issue4001> _______________________________________ _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com