[ python-Bugs-1630894 ] Garbage output to file of specific size

SourceForge.net noreply at sourceforge.net
Tue Jan 9 19:31:38 CET 2007


Bugs item #1630894, was opened at 2007-01-08 21:40
Message generated for change (Comment added) made by loewis
You can respond by visiting: 
https://sourceforge.net/tracker/?func=detail&atid=105470&aid=1630894&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: Windows
Group: Python 2.4
Status: Open
Resolution: None
Priority: 5
Private: No
Submitted By: Michael Culbertson (mculbert)
Assigned to: Nobody/Anonymous (nobody)
Summary: Garbage output to file of specific size

Initial Comment:
The attached script inexplicably fills the output file with garbage using the input file available at:

http://cs.wheaton.edu/~mculbert/StdDetVol_Scaled_SMDS.dat (4.6Mb)

If the string outputed in line 26 is changed to f.write("bla "), the output file is legible.  If the expression is changed from f.write("%g " % k) to f.write("%f " % k) or f.write("%e " % k), the file is legible.  If, however, the expression is changed to f.write('x'*len(str(k))+" "), the file remains illegible.  Adding a print statement:

   print "%g " % k 

before line 26 indicates that k is assuming the correct values and that the string interpolation is functioning properly.  This suggests that the problem causing the garbage may be related to the specific file size created with this particular set of data.

The problem occurs with Python 2.4.3 (#69, Mar 29 2006, 17:35:34) [MSC v.1310 32 bit (Intel)] under Windows XP.  The problem doesn't occur with the same script and input file using Python 2.3.5 on Mac OS 10.4.8. 

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

>Comment By: Martin v. Löwis (loewis)
Date: 2007-01-09 19:31

Message:
Logged In: YES 
user_id=21627
Originator: NO

Can you please report what the expected output is? Mine (created on Linux)
starts with

40 40 32 64

followed by many "0.0 " values.

Also, can you please report what the actual output is that you get? In
what way is it
"illegible"?

What version of Numeric are you using?

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

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


More information about the Python-bugs-list mailing list