[2to3] Bug converting import

Helmut Jarausch jarausch at igpm.rwth-aachen.de
Mon Jun 23 04:50:44 EDT 2008


Hi

Given the following two files in the same directory

Master.py:
----------
#!/usr/bin/python
import Slave
Slave.main()

and
Slave.py:
---------
def main() :
   print "Hello World"

Invoking Master.py under python-2.5.2
works just fine.

2to3 converts these to

Master.py:
----------
from . import Slave
Slave.main()

I have added the first line
#!/usr/local/bin/python3.0
manually

Slave.py:
---------
def main() :
   print("Hello World")


Now, when I invoke Master.py  I get

Traceback (most recent call last):
   File "Master.py", line 2, in <module>
from . import Slave
ValueError: Attempted relative import in non-package


thanks for looking into it,

Helmut Jarausch

Lehrstuhl fuer Numerische Mathematik
RWTH - Aachen University
D 52056 Aachen, Germany



More information about the Python-list mailing list