Path problem and Idle vs shell difference

Huaming Wang hwa786 at casbah.acns.nwu.edu
Mon May 31 10:36:20 EDT 1999


I think the SyntaxError comes from that you didn't put indentation before
"print i", I just tried in my win98 environment:
>>>import sys
>>>for i in sys.path:
...        print i
...
everything is fine.
Huaming

Emile van Sebille wrote:

> I've written some test code, placed it in a folder, and would like to test
> using idle.  I can get the main function to come up, but additional imports
> from my test folder fail. I can see that the path is wrong, and when I
> correct it, things work as expected.
>
> However, in uncovering this, I found the following:
>
> From within idle:
>
> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import sys
> >>> for i in sys.path:
>     i
>
> D:\Program Files\Python\Tools\idle
> D:\PROGRA~1\PYTHON\TOOLS\IDLE
> D:\PROGRA~1\PYTHON\LIB
> D:\Program Files\Python\Lib\plat-win
> D:\Program Files\Python\Lib
> D:\Program Files\Python\DLLs
> D:\Program Files\Python\Lib\lib-tk
> D:\PROGRAM FILES\PYTHON\DLLs
> D:\PROGRAM FILES\PYTHON\lib
> D:\PROGRAM FILES\PYTHON\lib\plat-win
> D:\PROGRAM FILES\PYTHON\lib\lib-tk
> D:\PROGRAM FILES\PYTHON
>
> and from a windows command prompt:
>
> [Windows 95] D:\Program Files\Python>python
> Python 1.5.2 (#0, Apr 13 1999, 10:51:12) [MSC 32 bit (Intel)] on win32
> Copyright 1991-1995 Stichting Mathematisch Centrum, Amsterdam
> >>> import sys
> >>> for i in sys.path:
> ... print i
>   File "<stdin>", line 2
>     print i
>         ^
> SyntaxError: invalid syntax
> >>>
>
> while
>
> >>> for i in sys.path: i
>
> works in both environments.  Can anyone explain the SystaxError?
>
> Also, I'd like to clean up sys.path and eliminate the 8.3 and case
> equivalents, but so far have not located where it originates.  Any help?
>
> Trying-to-follow-the-right-path-ly y'rs,
>
> --
>
> Emile van Sebille
> emile at fenx.com
> -------------------

--
    ^_^
Welcome to my homepage at http://topquark.phys.nwu.edu
     :)
800 Hinman Ave. Apt#604
Evanston, IL, 60202
Tel: (847)492-0603






More information about the Python-list mailing list