How can I run a program?

Thorsten Kampe thorsten at thorstenkampe.de
Sat Jul 30 07:11:50 EDT 2005


* Lad (2005-07-30 11:33 +0100)
> I am running Python on XP and have a problem with
> a  program  if its name consists '-' for example:
> my-program.py
> When I try to run a program with such name

/How/ do you "run" the program for Guido's sake?!

> I get the error :
> 
> Traceback (most recent call last):
>   File "<interactive input>", line 1, in ?
> NameError: name 'my' is not defined
> 
> Python thinks that the name of program is my.py only
> but the name is my-program.py
> 
> What is a solution?

The solution to get answers is to give details.

But to play the clairvoyant:

/If/ you tried to run the program from a command prompt or from by
klicking on the file there should be no problems.

/If/ you tried to run the program by importing it from the Python
shell, then this is normal. A hyphen is not allowed in module names at
it is the same character as in subtractation.



More information about the Python-list mailing list