Could you share a code snippet?
If you cat the file to hd does it read correctly even with the zero
filesize?




On Wed, Aug 29, 2012 at 1:19 AM, Tom Kuiper <kui...@jpl.nasa.gov> 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 <kui...@jpl.nasa.gov> 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
> e: a...@ska.ac.za
> w: www.ska.ac.za
>
>
>
>
> --
> I or me? http://www.oxforddictionaries.com/page/145
>
>


-- 
*Adam Barta*
c: +27 72 105 8611
e: a...@ska.ac.za
w: www.ska.ac.za

Reply via email to