Re: [Python-ideas] file.read() doesn't read the whole file
Sreejith K
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.
Is there any problem using read() method in fuse-python ?
Also statements like break and continue behaves weirdly in fuse functions. Any help is appreciated....
If you think break and continue are behaving differently in a python program that is providing a fuse filesystem implementation, then your understanding of what your code is doing is faulty in some fashion. The fact that python is being called from fuse isn't going to change the semantics of the language. So I think you need to do some debugging to understand what's actually going on when your code gets called. As someone else suggested, if you are perceiving that the data read is short because of what you see at the os level when reading the data from the fuse-plus-your-application filesystem, that is after your python code returns the data to the fuse infrastructure, then that is probably where your problem is and not in the python read itself. (I'm assuming here that the read in question is taking place in a python method called from fuse and is reading real data from a real file...if that assumption is wrong and you are actually reading from a file _provided through_ fuse, then you need to look to your fuse file system implementation for answers.) -- R. David Murray http://www.bitdance.com
participants (1)
-
R. David Murray