[PythonCE] line-endings problem with PythonCE
Michael Foord
mike at pcblokes.com
Mon Feb 7 09:07:02 CET 2005
This is because many python files are saved with UNIX line endings
instead of windows ones.
The easiest solution is simply to get python to open them and then write
them back out again.
handle = open(filename, 'r')
thefile = handle.read()
handle.close()
open(filename, 'w')..write(thefile)
will do the job.
Regards,
Fuzzy
http://www.voidspace.org.uk/python/index.shtml
Stewart Midwinter wrote:
>I've noticed that many of the python files that I edit on the desktop
>(or even most of those that I don't), when brought over the Pocket PC
>and opened in Tillanosoft Notepad or Total Commander's editor, have
>line endings that are recognized. Instead, there's a square symbol and
>the line does not break. This has led to a problem where one file,
>when opened, causes python to instantly crash. The same file can be
>opened in Pocket Word, but it simply deletes all of the line endings,
>thus making it impossible for me to read the file and parse it line by
>line.
>
>Have any of you experienced anything similar? What's your take on this?
>
>thanks,
>
>
More information about the PythonCE
mailing list