Thanks
Okay looks like the culprit is *sshfs* I tried it my side and it seems to fail when using it that way. I guess the problem is that *fuse* just wont let you read a zero byte file. It might be possible to trick fuse by making a character device. (mknod or mkfifo) Adam On Wed, Aug 29, 2012 at 1:36 AM, Tom Kuiper <[email protected]> wrote: > ** > On 08/28/2012 04:24 PM, Adam Barta wrote: > > Could you share a code snippet? > > Here's the code. > > If you cat the file to hd does it read correctly even with the zero > filesize? > > I'll have to make a small mod before trying that. I'll let you know. > > > Tom > > > > > > On Wed, Aug 29, 2012 at 1:19 AM, Tom Kuiper <[email protected]> wrote: > >> On 08/28/2012 04:11 PM, Adam Barta wrote: >> >> is it possible that ipython is not actually closing the file but keeping >> the file descriptor open behind your back, if so then seeking to 0 might >> solve it? >> >> Clever idea! but, alas, Python is cleverer than that. I put a seek(0) >> after (re)opening the file and before reading. Still get 0 bytes back. >> >> I'm not having much luck in finding a way to change the file size. There >> is a 'truncate' method that will do it but Linux will zero fill an extended >> file. >> >> Cheers >> >> Tom >> >> >> >> >> On Wed, Aug 29, 2012 at 1:00 AM, Tom Kuiper <[email protected]> wrote: >> >>> On 08/28/2012 03:54 PM, David MacMahon wrote: >>> >>>> On Aug 28, 2012, at 3:39 PM, Tom Kuiper wrote: >>>> >>>> >>>>> I don't know how to get Python to read more than teh nominal file size >>>>> if it is supposed to look like a file. >>>>> >>>>> >>>> If you want to read the register value a second time, you need to seek >>>> to the beginning of the file first, then read four bytes. You should be >>>> able to repeat the seek/read pattern as many times as you want. >>>> >>>> >>> I close the file after I write to it and open it again for the read. >>> After I write to the file, "ls -l" gives a size of zero instead of 4. >>> >>> If that's not what's confusing you, can you please clarify what is? >>>> >>> I am not trying to mix reads and writes on an open file. I know about >>> seek and tell if that were what I wanted to do. >>> >>> Tom >>> >>> >> >> >> -- >> *Adam Barta* >> c: +27 72 105 8611 <%2B27%2072%20105%208611> >> e: [email protected] >> w: www.ska.ac.za >> >> >> >> >> -- >> I or me? http://www.oxforddictionaries.com/page/145 >> >> > > > -- > *Adam Barta* > c: +27 72 105 8611 > e: [email protected] > w: www.ska.ac.za > > > > > -- > I or me? http://www.oxforddictionaries.com/page/145 > > -- *Adam Barta* c: +27 72 105 8611 e: [email protected] w: www.ska.ac.za

