help with an error msg please

Pavol Lisy pavol.lisy at gmail.com
Sun May 14 09:30:52 EDT 2017


On 5/14/17, Charles T. Smith <cts.private.yahoo at gmail.com> wrote:
> I'm stumped by this:

> $ 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
>
> what am I doing wrong?

Did you create getopt.py in your working directory? If so then try to
rename it.

PL.



More information about the Python-list mailing list