IDLE has suddenly become FAWLTY - so should I be hitting it with a big stick, or what?

Zachary Ware zachary.ware+pylist at gmail.com
Tue Aug 26 15:46:52 EDT 2014


On Tue, Aug 26, 2014 at 2:26 PM, Twirlip2 <ahrodg at googlemail.com> wrote:
> On Tuesday, 26 August 2014 19:46:55 UTC+1, Terry Reedy  wrote:
>> On 8/26/2014 2:01 PM, Twirlip2 wrote:
>>
>> > [...]
>
> Here are the aforementioned error messages (sorry, I didn't realise I could simply "select all" and "copy" text from a command window) - I hope the formatting doesn't get messed up. (I haven't used Google Groups in years.)
>
> Microsoft Windows XP [Version 5.1.2600]
> (C) Copyright 1985-2001 Microsoft Corp.
>
> Traceback (most recent call last):
>   File "I:\Python34\lib\runpy.py", line 170, in _run_module_as_main
>     "__main__", mod_spec)
>   File "I:\Python34\lib\runpy.py", line 85, in _run_code
>     exec(code, run_globals)
>   File "I:\Python34\lib\idlelib\__main__.py", line 8, in <module>
>     import idlelib.PyShell
>   File "I:\Python34\lib\idlelib\PyShell.py", line 18, in <module>
>     from code import InteractiveInterpreter
>   File "E:\Work\Comp\Python\Lib\code.py", line 28
>     path = getenv('PYTHONPATH') + r'\'
>                                      ^
> SyntaxError: EOL while scanning string literal

It looks like the problem is that you've named your module 'code.py',
which is the name of a standard library module used by IDLE.  So, when
IDLE tries to 'from code import InteractiveInterpreter', instead of
getting I:\Python34\lib\code.py, it's getting
E:\Work\Comp\Python\Lib\code.py, which isn't going to work :).

Incidentally, your SyntaxError is due to trying to use r'\' to get a
backslash literal.  Even with r'' strings, backslash will escape a
quote character (but the backslash remains in the string).  In this
case, it's simplest to just use '\\'.

Hope this helps,
-- 
Zach



More information about the Python-list mailing list