This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: SyntaxError raised on win32 for correct files
Type: Stage:
Components: Interpreter Core Versions: Python 2.4
process
Status: closed Resolution: fixed
Dependencies: Superseder:
Assigned To: Nosy List: doerwalter, fog, glchapman, julien_sagnard, tim.peters
Priority: normal Keywords:

Created on 2005-05-12 14:19 by fog, last changed 2022-04-11 14:56 by admin. This issue is now closed.

Files
File name Uploaded Description Edit
dt.py fog, 2005-05-12 14:19
Messages (7)
msg25292 - (view) Author: Federico Di Gregorio (fog) * Date: 2005-05-12 14:19
Try to import the attached file (dt.py) on Windows with
Python 2.4 or 2.4.1 and you'll get a SyntaxError (the
file was written a long time ago, and worked perfectly
well on Python 2.1, 2.2 and 2.3.) The same does not
happen when importing the same module on Linux (tested
with 2.4 and 2.4.1). When the module imports fine
you'll get an ImportError (don't want to attach all
dependencies here) but the SyntaxError comes before that.

Also note that compiling the file with
compiler.compileFile("dt.py") generates a perfectly
good .pyc file that can be later imported just fine
(tested with 2.4 and 2.4.1 on Windows).
msg25293 - (view) Author: Greg Chapman (glchapman) Date: 2005-05-18 14:15
Logged In: YES 
user_id=86307

I'm fairly sure this is caused by the bug described here:
  
   www.python.org/sf/1175396

The module imports without syntax error on my Windows system
(with a patched codecs.py to work around the above bug).
msg25294 - (view) Author: Julien Sagnard (julien_sagnard) Date: 2005-07-19 16:05
Logged In: YES 
user_id=1181710

I have a similar problem with an other file (log.py).
On my computer ( Windows 2000 ) this 2 files ( log.py and
dt.py ) works with python 2.4 but raise a syntax error on
python 2.4.1 :

D:\dvt\tmp\bug2_4_1>python -c "import log"
Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "D:\dvt\tmp\bug2_4_1\log.py", line 356
      w = 72
       ^
SyntaxError: invalid syntax
msg25295 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-07-19 16:19
Logged In: YES 
user_id=89016

This bug should be fixed in the current CVS version. So, can
you retry with current CVS? As a workaround you might also
want to remove the PEP 263 coding declaration if you don't
have any special character in your file.
msg25296 - (view) Author: Julien Sagnard (julien_sagnard) Date: 2005-07-20 09:37
Logged In: YES 
user_id=1181710

It's ok if I remove coding declaration.
I have no access to current cvs, but if someone send me a
zip with latest version, I can try it.
msg25297 - (view) Author: Walter Dörwald (doerwalter) * (Python committer) Date: 2005-08-31 16:56
Logged In: YES 
user_id=89016

Copying codecs.py from current CVS (2.4 branch) over your
codecs.py (making a backup first) should be sufficient to
test this. You can this version from
http://cvs.sourceforge.net/viewcvs.py/*checkout*/python/python/dist/src/Lib/codecs.py?rev=1.35.2.9
msg25298 - (view) Author: Tim Peters (tim.peters) * (Python committer) Date: 2005-09-05 01:15
Logged In: YES 
user_id=31435

dt.py imports fine (except for the ImportError the OP 
mentioned) under current CVS HEAD and under current 2.4 
maintenance branch, on Windows XP Pro SP2, so closing 
this as fixed.
History
Date User Action Args
2022-04-11 14:56:11adminsetgithub: 41976
2005-05-12 14:19:31fogcreate