Help!!! New to Python and getting an error I can't figure out
Tim Chase
python.list at tim.thechases.com
Mon Nov 20 14:31:09 EST 2006
> I'm learning python and from a book I tried this program: (all the
> indentation is there just doen't appear in this EMail)
> ----------------------------------------------------------
> if __name__ == "__main__":
> (g = dirGrep("c:\\winnt"))
>
> When I try to run the program - python grep.py - I get the following error:
>
> C:\> python grep.py
> File "grep.py", line 28
> if __name__ == '__main__':
> ^
> SyntaxError: invalid syntax
I suspect it has to do with the funky (useless? unneeded?
worthless? broken? borked? crack-smokin'?) parens around the
non-statement in the subsequent (#29) line.
The error is a little misleading, as there's nothing wrong with
line #28 per-se, but rather the following line.
-tkc
More information about the Python-list
mailing list