[SciPy-user] fromfile, item, what other output than stdout / stderr is used ?

Stef Mientki s.mientki at ru.nl
Sun May 10 06:02:24 EDT 2009


hello,

I'm using "fromfile" to read data from a file generated by another program.
The data is read on the same operating system as where the file was created.
I use on several locations, at the procedure seems to run very well, but ...
... when run the program from the normal window command box,
I get an error message:
    "40 items requested but only 10 read"

Normally I run all the programs with either a hidden command window or 
from some kind of IDE.
In the IDE, stdout and stderr are redirected, and I see all print 
commands and errors in the redirection window,
but I don't see the above error message from numpy.
So it seems that numpy is using a third kind of output device.
???

Now from the documentation at
  http://docs.scipy.org/doc/numpy/reference/generated/numpy.fromfile.html
I read:

numpy.fromfile(/file/, /dtype=float/, /count=-1/, /sep=''/)

*count* : int

    Number of items to read. -1 means all items (i.e., the complete file).


What is a item ?
Is it in bytes, or as in my case, where dtype is an 32 bit integer, in 
integers (which I would read from the documentation) ?

Well it must be a byte I guess,
because if I use bytes as the count, the program is working well,
but I get the above error message in the windows command window.
If I use the integer count, the program crashes almost immediately,
and thereby I can see sometimes the follwing error messages:
     16 items requested but only 10 read
     12 items requested but only 0 read
    ....
    self.data = fromfile ( self.Data_File, dtype=int ,count=new_bytes )
MemoryError
Fatal Python error: (pygame parachute) Segmentation Fault

thanks,
Stef Mientki



More information about the SciPy-User mailing list