AttributeError: 'getopt' module has no attribute 'GetoptError'

Gustaf Liljegren gustafl at algonet.se
Tue Jul 3 19:12:25 EDT 2001


gustafl at algonet.se (Gustaf Liljegren) wrote:

> Try to use the getopt module, but get the error in the subject line.
> What's wrong?

Still a true mystery.

> Another question about getopt: Are options optional by nature? You
> can't have a mandatory option?

Found the answer to this myself: "Unlike GNU getopt(), after a non-option 
argument, all further arguments are considered also non-options. This is 
similar to the way non-GNU Unix systems work."

What I want to do is something like:

  python script.py <single command> <some options> <some arguments>

Hm...maybe I should write my own getopt? Maybe someone already did? :-)

Regards,

Gustaf Liljegren



More information about the Python-list mailing list