Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-13 Thread Tim Hirzel
Thanks for everyone's help and thoughts. I agree that this behavior is buggy. I submitted a bug report to the python project at sourceforge, with a link to this thread. Hopefully the report will be helpful. tim Charles R Harris wrote: > > > On 12/12/06, *Travis Oliphant* <[EMAIL PROTECTED]

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Charles R Harris
On 12/12/06, Travis Oliphant <[EMAIL PROTECTED]> wrote: Tim Hirzel wrote: >Good thought Chris, >Normal reading and writing does seem to work. .. >But, my friend Daniel figured out a workaround when I asked to confirm >this behavior on his windows setup (and it is does behave the same for >him).

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Lisandro Dalcin
> > It seems to me that the temporary file mechanism on Windows is a little > odd. > Indeed, looking at sources, the posix version uses the mkstemp/unlink idiom.. but in win it uses a bit of hackery. It seems opened files cannot be unlinked. if _os.name != 'posix' or _os.sys.platform == 'cygwin'

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Travis Oliphant
Tim Hirzel wrote: >Good thought Chris, >Normal reading and writing does seem to work. .. >But, my friend Daniel figured out a workaround when I asked to confirm >this behavior on his windows setup (and it is does behave the same for >him). The first clue was this: > > >>> f = tempfile.Temporar

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Tim Hirzel
Good thought Chris, Normal reading and writing does seem to work. .. But, my friend Daniel figured out a workaround when I asked to confirm this behavior on his windows setup (and it is does behave the same for him). The first clue was this: >>> f = tempfile.TemporaryFile() >>> type(f) >>>

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Christopher Barker
did you try reading and writing to/from that temp file with regular old python functions? -Chris Tim Hirzel wrote: >> I'm running linux and the current svn version of numpy. Maybe the >> problem is with the tempfile module on windows. Do fromfile and tofile >> work for files opened normally?

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Tim Hirzel
> I'm running linux and the current svn version of numpy. Maybe the > problem is with the tempfile module on windows. Do fromfile and tofile > work for files opened normally? > > Chuck fromfile and tofile work fine on regular files. From skimming the code a bit, it's hard to imagine numpy cod

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Charles R Harris
On 12/12/06, Tim Hirzel <[EMAIL PROTECTED]> wrote: Hi Chuck, Thanks for checking that. I am running numpy 1.0.1 in python 2.4 on win32 (xp). Are you on linux? I double checked the behavior in 1.0 and 1.0.1, just to be extra sure, and it thows the IOError in both cases. tim I'm running lin

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-12 Thread Tim Hirzel
Hi Chuck, Thanks for checking that. I am running numpy 1.0.1 in python 2.4 on win32 (xp). Are you on linux? I double checked the behavior in 1.0 and 1.0.1, just to be extra sure, and it thows the IOError in both cases. tim Charles R Harris wrote: > > > On 12/11/06, *Tim Hirzel* <[EMAIL PROTE

Re: [Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-11 Thread Charles R Harris
On 12/11/06, Tim Hirzel <[EMAIL PROTECTED]> wrote: Hi, Does anyone know how to get fromfile and tofile to work from a tempfile.TemporaryFile? Or if its not possible? I am getting this: >>> import tempfile >>> f = tempfile.TemporaryFile() >>> f ', mode 'w+b' at 0x01EE1728> >>> a = numpy.arange(

[Numpy-discussion] fromfile and tofile access with a tempfile.TemporaryFile()

2006-12-11 Thread Tim Hirzel
Hi, Does anyone know how to get fromfile and tofile to work from a tempfile.TemporaryFile? Or if its not possible? I am getting this: >>> import tempfile >>> f = tempfile.TemporaryFile() >>> f ', mode 'w+b' at 0x01EE1728> >>> a = numpy.arange(10) >>> a.tofile(f) Traceback (most recent call