Python-2.3b1 bugs on Windows2000 with: the new csv module, string replace, and the re module

Daniel Ortmann dortmann at lsil.com
Wed Jul 2 01:01:55 CEST 2003


These problems only happen on Windows.  On Linux everything works fine.
Has anyone else run into these bugs?  Any suggestions?

Where do I find out the proper bug reporting process?


Problem #1:

While using the csv module's DictWriter on MSDOS (a.k.a. Windows2000),
the output files get newlines like \x0d\x0d\x0a instead of \x0d\x0a.

csvwriter = csv.DictWriter( file( out1filename, 'w' ), infieldnames, extrasaction='ignore' )
csvwriter.writerow( dict( zip( infieldnames, infieldnames ) ) )

Problem #2:

While trying to fix up the first problem I run into another problem.
The following string replace code works until right around the boundary
at 2^7 * 1024, i.e. near 131072 (around line 1224), and then inserts a
bunch of \x00's in the string!

Before the \x00's, all of the \x0d's were correctly replaced.  After the
\x00's, NONE of them were replaced.

content = file( fname, 'rb' ).read().replace( '\x0d', '' )
file( fname, 'wb' ).write( content )

Problem #3:

The same problem also happens with the re module.

content = re.sub( '\x0d', '', file( fname, 'rb' ).read() )
file( fname, 'wb' ).write( content )

-- 
Daniel Ortmann, LSI Logic, 3425 40th Av NW, Suite 200, Rochester MN 55901
work: Daniel.Ortmann at lsil.com / 507.535.3861 / 63861 int / 8012.3861 gdds
home: ortmann at isl.net / 507.288.7732, 2414 30Av NW #D, Rochester MN 55901




More information about the Python-list mailing list