[Python-bugs-list] [ python-Bugs-464405 ] freeze doesn't like DOS files on Linux

noreply@sourceforge.net noreply@sourceforge.net
Tue, 12 Nov 2002 15:21:22 -0800


Bugs item #464405, was opened at 2001-09-24 09:41
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=464405&group_id=5470

Category: Demos and Tools
>Group: Python 2.3
>Status: Closed
>Resolution: Fixed
Priority: 5
Submitted By: Nobody/Anonymous (nobody)
>Assigned to: Neal Norwitz (nnorwitz)
Summary: freeze doesn't like DOS files on Linux

Initial Comment:
I've got a perfectly running Python program on Linux, 
importing some modules that were apparently written 
on Windows, since the files are in DOS format 
(carriage return + line feed at the end of lines).

When I try to freeze this program, the module finder 
crashes on every module in DOS format claiming that 
there's a syntx error at the end of each line.

This is not really serious, but quite annoying...

Thanks.


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

>Comment By: Neal Norwitz (nnorwitz)
Date: 2002-11-12 18:21

Message:
Logged In: YES 
user_id=33168

I don't know if there's an easy way to fix this for 2.2.x,
so I'm fixing this for 2.3 with universal newlines.

Checked in as:
 * Tools/freeze/modulefinder.py 1.22

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

Comment By: Neal Norwitz (nnorwitz)
Date: 2002-10-18 16:56

Message:
Logged In: YES 
user_id=33168

I added "U" for the mode flag to open() for universal
newlines.  This fixed the problem.  I modified
Tools/freeze/modulefinder.py in run_script() and load_file()
about lines 120 and 127.  I didn't see any other open()s
which seemed to need "U".

Is that sufficient to close this bug?

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

Comment By: Guido van Rossum (gvanrossum)
Date: 2001-09-27 14:02

Message:
Logged In: YES 
user_id=6380

I can reproduce this with Python 2.2 quite easily: on Linux,
in the Tools/freeze directory, use the ../scripts/lfcr.py
script to give hello.py CRLF line endings.  Then try to
freeze it.

The cause is the code in the tokenizer that parses from
strings, which doesn't like the \r\n line endings and
doesn't throw the \r out like the code that parses from a
file does.

I'm tempted to request a feature that the tokenizer should
be smarter when it finds a \r (e.g. just ignore it).

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

Comment By: Martin v. L÷wis (loewis)
Date: 2001-09-26 15:51

Message:
Logged In: YES 
user_id=21627

What Python version? Could you please submit an example of 
one of the files it is complaining about? Since you cannot 
attach it to this report, it would be good if you could 
open a new report. When doing so, please identify 
yourself. 


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

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