getopt, i don't get it

Peter Hansen peter at engcorp.com
Tue Oct 28 14:45:14 EST 2003


Dominik Kaspar wrote:
> 
> I tried to use getopt and copied the example from:
> http://www.python.org/doc/current/lib/module-getopt.html
> 
> but nothing is working... getopt.GetoptError doesn't seem to exist and
> when i run the program commenting this out, none of "-v", "-h" and
> "-o" wants to be recognized... what's the matter?!

It seems likely you have another file called getopt.py (or perhaps
a leftover getopt.pyc from a previous time) in your Python path
(check all directories in sys.path, starting with current directory).

You can't safely reuse the names of standard library modules most
of the time...

-Peter




More information about the Python-list mailing list