On Mar 21, 12:58 am, I V <ivle...@gmail.com> wrote: > On Fri, 20 Mar 2009 07:03:35 -0700, Sreejith K wrote: > > I'm using the above codes in a pthon-fuse's file class's read function. > > The offset and length are 0 and 4096 respectively for my test inputs. > > When I open a file and read the 4096 bytes from offset, only a few lines > > are printed, not the whole file. Actually the file is only a few bytes. > > But when I tried reading from the Interactive mode of python it gave the > > whole file. > > Your example doesn't show what you are doing with "data" after you've > read it. Presumably you're outputting it somehow, which is where you see > that it doesn't contain the whole file. But are you sure the problem is > in the reading, and not in the outputting? Could you show the section of > the code where you output "data"? Thanks,
I think there is no use in showing the whole code (which is a filesystem implementation using python-fuse), but if you want it I'll post it, see the next post :) Forget about the 'data' variable (I'm just returning it at the end of the function). But even if I'm returning self.snap.read(length), it doesn't read length (if length is larger than the size of the file then till EOF) bytes from the file. But this only happens when the second code samples (they're used in fuse-python classes) and not in the first example. In the normal interactive python shell the same procedure returns the whole file (using read() or read(4096) which is a particular case)... I'm sure, In my case, self.snap is opening the file ./mango.txt_snaps/ snap1/0 and off and length variables are 0 and 4096 respectively. The file ./mango.txt_snaps/snap1/0 is only 56 bytes with 9 lines of text. But either read(4096)/read() in the second example reads/returns only 7 lines. But this happens only in when using it in a fuse-python file class's read function. In normal interactive mode it reads the whole file. Hope you understand the problem now. I'm very sorry that I couldn't explain the problem very well. -- http://mail.python.org/mailman/listinfo/python-list