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. |