idl hangs when reading ascii file [message #80246] |
Fri, 18 May 2012 09:17 |
Søren Frimann
Messages: 13 Registered: November 2010
|
Junior Member |
|
|
Hi all,
I'm having a problem that I myself at least consider very strange.
I'm running the below bit of code in IDL
*****************************
spawnrob, 'cat rot.out',data
instr = fltarr(2,n_elements(data))
print, n_elements(data)
for i=0,n_elements(data)-1 do begin
instr(*,i) = float(strsplit(data(i),/extract))
endfor
*********************************
The code uses the shell command cat to read the file 'rot.out'. This
piece of code is runs over and over since the ascii file 'rot.out' is
constantly deleted and created anew. At some point however some
process hang -- I have no control of the terminal and have to kill
idl.
I know the problem comes from the above piece of code from printing
diagnostic statements throughout the program, and I've discovered that
it always stalls at some point within the for-loop
There seems to be no problem with the ascii file itself (after killing
I can restart idl and read the file with no problems), and the code
will have worked fine for more than 100 calls before failing.
I've tried introducing wait commands to make sure that the ascii file
has been written and deleted properly from the disk before trying to
read it, but that doesn't help either.
I've tried several other ways of reading in the file, but nomatter
what method I use the code will always fail after some time.
I'm on ubuntu 12.04 32-bit and use IDL 7.0. I've also tried running
the code on my Ubuntu 12.04 64-bit laptop, also running IDL 7.0, but
with same result.
I've never had a problem in IDL that baffles me quite this much. Any
help would be much appreciated.
Cheers,
Søren
|
|
|