python3 import idlelib.PyShell fails

Helmut Jarausch jarausch at skynet.be
Sun Jun 30 07:07:36 EDT 2013


Hi,

I have a strange error. When I try import idlelib.PyShell from Python3.3 it fails
with

Python 3.3.2+ (3.3:68ff68f9a0d5+, Jun 30 2013, 12:59:15) 
[GCC 4.7.3] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import idlelib.PyShell
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib64/python3.3/idlelib/PyShell.py", line 29, in <module>
    from idlelib.EditorWindow import EditorWindow, fixwordbreaks
  File "/usr/lib64/python3.3/idlelib/EditorWindow.py", line 11, in <module>
    import webbrowser
  File "/usr/lib64/python3.3/webbrowser.py", line 7, in <module>
    import shlex
  File "./shlex.py", line 56
    print 'shlex: reading from %s, line %d' \
                                          ^
SyntaxError: invalid syntax


Looking at shlex.py from /usr/lib64/python3.3 there is no print
statement in line 56.

But, looking at /usr/lib/python2.7/shlex.py there is this print statement
in line 56.

Why does idlelib.PyShell when imported from Python3 import shlex from
Python2 ?

What's going on here?

Many thanks for a hint,
Helmut.



More information about the Python-list mailing list