I a beginner level python user and when I type the following in the terminal:
$ pydoc Inleesgenbank.py
I get the following error message:
problem in ./Inleesgenbank.py - : invalid syntax (Inleesgenbank.py, line 30)
So at line 30 there must be a syntaxis error in this code:
def usage(msg1=''):
"""Levert de docstring met een foutspecificatie bij een gebruikersfout"""
print(__doc__, file=sys.stderr)
if len(msg1) > 0:
print('FOUTMELDING:', msg1, file=sys.stderr)
Line 30 is the line: print(__doc__, file=sys.stderr)
I know this is not a very clean piece of code but I want to learn what is wrong with it.
I don't get a syntax error running on Python 3, but I do get a syntax error on Python 2. You are using the Python 3 print syntax.
For Python 2 you should use:
print >> sys.stderr, usage.__doc__
Note also that you probably meant usage.__doc__