compiler module bug?

Brian Blais bblais at
Sun Oct 21 18:36:46 CEST 2007


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


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

print ast

the documentation, here 
compiler.html  says that the two lines with parse and parseFile are  

the file I am trying to parse is simply:

def main():


     # 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?


			Brian Blais

Brian Blais
bblais at

-------------- next part --------------
An HTML attachment was scrubbed...
URL: <>

More information about the Python-list mailing list