[Numpy-discussion] Using loadtxt() twice on same file freezes python

Sander de Kievit dekievit@strw.leidenuniv...
Thu Mar 26 15:24:30 CDT 2009


David Cournapeau wrote:
> On Fri, Mar 27, 2009 at 1:14 AM, Sander de Kievit
> <dekievit@strw.leidenuniv.nl> wrote:
>> Hi,
>>
>> On my PC the following code freezes python:
>>
>> [code]
>> import numpy as np
>> from StringIO import StringIO
>> c = StringIO("0 1\n2 3")
>> np.loadtxt(c)
>> np.loadtxt(c)
>> [/code]
>>
>> Is this intentional behaviour or should I report this as a bug?
> 
> Which version of numpy are you using (numpy.version.version), on which OS ?
The specifics for my platform:
Fedora release 10 (Cambridge)
kernel: 2.6.27.19-170.2.35.fc10.i686 #1 SMP
python: 2.5.2
numpy: 1.2.0

Also, if I close the file in between the two calls it works without 
problem (if I use a real file, that is).

> 
> That's a most definitly not expected behavior (you should get an
> exception the second time because the "stream" is empty - which is
> exactly what happens on my installation, but your problem may be
> platform specific).
> 
> cheers,
> 
> David

Thanks for the quick replies! I'll report the bug.

Sander


More information about the Numpy-discussion mailing list