Hello,

I am experiencing a problem with the compiler module. Is this a bug, or am I doing something wrong?

so I have the following code:

from compiler import parse, parseFile

filename='blah.py'

if False:  # turn this to false, to get it to work
ast = parse(open(filename).read()) # this line gives a syntax error
else:
    ast = parseFile(filename)  # this line works


print ast


the documentation, here http://docs.python.org/lib/module- compiler.html says that the two lines with parse and parseFile are equivalent.

the file I am trying to parse is simply:

def main():

    a=10

    # comment at the end of the file




it seems like a comment at the end breaks the parse command, but not parseFile. Is this reproducible by others?

am I doing something wrong?

                thanks,

                        Brian Blais



--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais



-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to