[ python-Bugs-992207 ] exec statement balks at CR/LF

SourceForge.net noreply at sourceforge.net
Fri Jul 16 11:21:42 CEST 2004


Bugs item #992207, was opened at 2004-07-16 09:21
Message generated for change (Tracker Item Submitted) made by Item Submitter
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=992207&group_id=5470

Category: Parser/Compiler
Group: Python 2.3
Status: Open
Resolution: None
Priority: 5
Submitted By: Konrad Hinsen (hinsen)
Assigned to: Nobody/Anonymous (nobody)
Summary: exec statement balks at CR/LF

Initial Comment:
Under Linux and MacOS (no others tested), if "foo.py" is a DOS/
Windows style Python file (CR/LF line endings), then

  python foo.py

will work, as will

  execfile("foo.py")

and

  exec file("foo.py")

from inside Python. However,

   exec file("foo.py").read()

will report a syntax error. In other words, the parser seems to 
accept CR/LF only if the source of the data is a file, not a string.

When running under Linux and MacOS (no others tested), the exec 
statement reports a syntax error. I didn't find anything about this 
in the documentation, so I don't know if it's a bug or a feature. If 
it's a feature, it is not a useful one!



----------------------------------------------------------------------

You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=992207&group_id=5470


More information about the Python-bugs-list mailing list