On Oct 21, 2007, at Oct 21:1:15 PM, Gabriel Genellina wrote:
En Sun, 21 Oct 2007 13:36:46 -0300, Brian Blais <[EMAIL PROTECTED]>
escribi�:
I am experiencing a problem with the compiler module. Is this a bug,
or am I doing something wrong?
I think it's a well-known fact...
it seems like a comment at the end breaks the parse command, but not
parseFile. Is this reproducible by others?
The comment itself is not a problem; but the last line in the
source must
end in a newline.
See the py_compile/compileall modules as an example.
I didn't see anything in that module which mentions this issue
(perhaps I missed it). however, if the documentation states:
parseFile(
path)
Return an abstract syntax tree for the Python source code in the file
specified by path. It is equivalent to parse(open(path).read()).
then, even if it is known problem, the docs are wrong. the two
(parseFile(path) and parse(open(path).read())) are *not* the same:
one can handle a file which doesn't end in a newline, another one
can't handle the same file.
Can one hack it like:
filestr=open(filename).read()
filestr+="\n"
before going to parse, or will that give problems?
thanks,
bb
--
Brian Blais
[EMAIL PROTECTED]
http://web.bryant.edu/~bblais
--
http://mail.python.org/mailman/listinfo/python-list