Bugs item #1225059, was opened at 2005-06-21 20:56 Message generated for change (Comment added) made by doerwalter You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1225059&group_id=5470
Please note that this message will contain a full copy of the comment thread, including the initial issue submission, for this request, not just the latest update. Category: Parser/Compiler Group: Python 2.4 Status: Open >Resolution: Duplicate Priority: 5 Submitted By: Nicolas Lehuen (nlehuen) >Assigned to: Walter Dörwald (doerwalter) Summary: Line endings problem with Python 2.4.1 cause imports to fail Initial Comment: Hi, Here is my Python version string : ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on win32 I'm having troubles with a series of source code files that were working perfectly under Python 2.4.0 and earlier releases. I have enclosed one of those source files which should be independent of the rest, so that you can test it by yourself. Now, here is my problem : ------------ Test 1 --------------- C:\projets\development\python\tcc>python ActivePython 2.4.1 Build 245 (ActiveState Corp.) based on Python 2.4.1 (#65, Mar 30 2005, 09:33:37) [MSC v.1310 32 bit (Intel)] on win3 Type "help", "copyright", "credits" or "license" for more information. >>> import util Traceback (most recent call last): File "<stdin>", line 1, in ? File "util.py", line 612 _max=None ^ SyntaxError: invalid syntax --- interpretation : this is the problem, the Python interpreter fails to parse the file. Note that is is a DOS-style file, with \r\n as lines separator, instead of simply \n. If I convert the file to a UNIX-style, \n separated lines format, then everything is OK. ------------ Test 2 --------------- C:\projets\development\python\tcc>python -i util.py C:\projets\development\python\tcc>python -i util.py >>> ^Z --- interpretation : launching the script instead of importing it is OK. It seems that the way scripts are loaded for direct launching is different than the way they are loaded for import. ------------ Test 3 --------------- C:\projets\development\python\tcc>python -m util File "C:\projets\development\python\tcc\util.py", line 612 _max=None ^ SyntaxError: invalid syntax --- interpretation : using another way to import the module and launch it yield the same buggy behaviour. Once again, if I convert line termination from DOS to UNIX, everything is OK. I've seen a few bugs related to rstrip() and readline() having a new behaviour, maybe this problem is related ? This is quite an annoying bug, because some perfectly valid code just stop working. The workaround is to convert everything to UNIX format, which is a bit tiresome given that my code is distributed on a bunch of computers... ---------------------------------------------------------------------- >Comment By: Walter Dörwald (doerwalter) Date: 2005-06-22 12:56 Message: Logged In: YES user_id=89016 This is indead a duplicate of bug #1175396 and related ones. Your problem should be fixed in the current CVS version. Can you retry with the current CVS version? As a possible workaround you might want to change the encoding from cp-1252 to iso-8859-1. Does this fix anything for you? ---------------------------------------------------------------------- You can respond by visiting: https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1225059&group_id=5470 _______________________________________________ Python-bugs-list mailing list Unsubscribe: http://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com