IDLE: Error when running script

jaime suarez jaime.suarez at crossmatch.net
Thu Dec 19 14:04:51 EST 2002


I get the following error message when running a script (please
see below) in IDLE.  The same script runs fine under PythonWin.

Error message appearing in the *Python Shell*:

IDLE 0.8 -- press F1 for help
>>> 
  File "C:\Python21\MyProjects\PythonWin\pywindemo.py", line 14
    main()
         ^
SyntaxError: invalid syntax
-------------------------------------------------------------
Script as it appears in the editor:

(1) def hello(msg):
(2)    print "Hello, " + msg
(3)
(4)def main():
(5)    import sys
(6)    print "Script name is", sys.argv[0]
(7)    if len(sys.argv)>=2:
(8)        hello(sys.argv[1])
(9)    else:
(10)       hello("Please say something next time")
(11)
(12)
(13)if __name__=='__main__':
(14)    main()


Thank you in advance,
Jaime



More information about the Python-list mailing list