help with an error msg please
Lutz Horn
lutz.horn at posteo.de
Sun May 14 09:20:49 EDT 2017
> $ PYTHONPATH= python except
> Traceback (most recent call last):
> File "except", line 7, in <module>
> except getopt.error, msg:
> AttributeError: 'module' object has no attribute 'error'
>
>
> The program is:
>
> $ cat except
> #!/usr/bin/env python
>
> import getopt
>
> try:
> opts, args = getopt.getopt (sys.argv[1:], "t:")
> except getopt.error, msg:
> raise "Usage: some other way", msg
I guess you are using Python 2.
In any case you should
import sys
if you want to access sys.argv.
Lutz
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 907 bytes
Desc: OpenPGP digital signature
URL: <http://mail.python.org/pipermail/python-list/attachments/20170514/97d01fc8/attachment.sig>
More information about the Python-list
mailing list