Re: Creating Import Hooks

2010-02-18 Thread Sreejith K
On Feb 18, 3:49 pm, Jean-Michel Pichavant wrote: > Sreejith K wrote: > > On Feb 18, 1:57 pm, Steven D'Aprano > > wrote: > > >> On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: > > >>> On Feb 17, 10:48 pm, Sreejith K wrote: > >

Re: Creating Import Hooks

2010-02-18 Thread Sreejith K
On Feb 18, 1:57 pm, Steven D'Aprano wrote: > On Thu, 18 Feb 2010 00:03:51 -0800, Jonathan Gardner wrote: > > On Feb 17, 10:48 pm, Sreejith K wrote: > >> Hi everyone, > > >> I need to implement custom import hooks for an application > >> (http://w

Creating Import Hooks

2010-02-17 Thread Sreejith K
Hi everyone, I need to implement custom import hooks for an application (http:// www.python.org/dev/peps/pep-0302/). I want to restrict an application to import certain modules (say socket module). Google app engine is using a module hook to do this (HardenedModulesHook in google/ appengine/tools/

Re: Changing Python Opcodes

2009-08-18 Thread Sreejith K
On Aug 18, 12:19 pm, "Diez B. Roggisch" wrote: > Did you try installing the egg *without* pyc-files in there? Because > naturally those shouldn't work. They shouldn't crash the interpreter > either, but then again - you *did* modify it. Hi Diez, thanks for the immediate reply :) I installed the

Changing Python Opcodes

2009-08-17 Thread Sreejith K
Hi, I know this is not the best way to do it. But I have to do it at least to make it *hard* to decompile the python bytecode. I want to distribute a software written in Python without the source. So I compiled Python from source changing some opcode values (Taking care of HAVE_ARGUMENT value) an

statvfs clearance

2009-04-04 Thread Sreejith K
Python's statvfs module contains the following indexes to use with os.statvfs() that contains the specified information statvfs.F_BSIZE Preferred file system block size. statvfs.F_FRSIZE Fundamental file system block size. statvfs.F_BLOCKS Total number of blocks in the filesystem. s

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
> It's not a redirect to a file.  Fuse calls the 'read' function on the > class, the read function does a 'return' of the data, and fuse passes > the data up through the OS layer to be the result of the 'read' call > made by less. By redirection I meant reading the snapshot file instead of the ori

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
On Mar 24, 4:45 pm, "R. David Murray" wrote: > Sreejith K wrote: > > On Mar 24, 2:12 pm, Ant wrote: > > > On Mar 24, 7:59 am, Sreejith K wrote: > > > ... > > > > > data is the whole file, but 'less' gives only the two lines... >

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
On Mar 24, 2:12 pm, Ant wrote: > On Mar 24, 7:59 am, Sreejith K wrote: > ... > > > data is the whole file, but 'less' gives only the two lines... > > From this statement (that you are using less), it appears that you are > redirecting sys.stdout to a file or

Re: file.read() doesn't read the whole file

2009-03-24 Thread Sreejith K
On Mar 24, 7:15 am, "Gabriel Genellina" wrote: > En Mon, 23 Mar 2009 21:37:14 -0300, R. David Murray   > escribió: > > > > > Steve Holden wrote: > >> Sreejith K wrote: > >> >> Try and write an example that shows the problem in fifteen li

Re: file.read() doesn't read the whole file

2009-03-22 Thread Sreejith K
> Try and write an example that shows the problem in fifteen lines or > less. Much easier for us to focus on the issue that way. import os def read(length, offset): os.chdir('/mnt/gfs_local/') snap = open('mango.txt_snaps/snap1/0','r') snap.seek(offset) data = snap.

Re: file.read() doesn't read the whole file

2009-03-22 Thread Sreejith K
> Try and write an example that shows the problem in fifteen lines or > less. Much easier for us to focus on the issue that way. import os def read(length, offset): os.chdir('/mnt/gfs_local/') snap = open('mango.txt_snaps/snap1/0','r') snap.seek(offset) data = snap.

Re: file.read() doesn't read the whole file

2009-03-22 Thread Sreejith K
> Try and write an example that shows the problem in fifteen lines or > less. Much easier for us to focus on the issue that way. import os def read(length, offset): os.chdir('/mnt/gfs_local/') snap = open('mango.txt_snaps/snap1/0','r') snap.seek(offset) data = snap.

Re: file.read() doesn't read the whole file

2009-03-21 Thread Sreejith K
The break and continue problem was actually my own mistake. I wrote no_blks = length/4096 + 1, so the loop actually executes twice. Sorry for my idiotic mistake But the read() problem still persists. Thanks.. -- http://mail.python.org/mailman/listinfo/python-list

Re: file.read() doesn't read the whole file

2009-03-20 Thread Sreejith K
On Mar 21, 10:54 am, "R. David Murray" wrote: > Sreejith K wrote: > >                                    tf.writelines("Reading from Base File\n") > >                                    self.file.seek(block*4096 + off%4096) > >                

Re: file.read() doesn't read the whole file

2009-03-20 Thread Sreejith K
class MedusaFile(object): def __init__(self, path, flags, *mode): global METHOD global NORMAL global SNAP global FRESH_SNAP self.path = path

Re: file.read() doesn't read the whole file

2009-03-20 Thread Sreejith K
On Mar 21, 12:58 am, I V 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

Re: file.read() doesn't read the whole file

2009-03-20 Thread Sreejith K
On Mar 20, 4:43 pm, "R. David Murray" wrote: > Sreejith K wrote: > > Hi, > > > >>> snapdir = './mango.txt_snaps' > > >>> snap_cnt = 1 > > >>> block = 0 > > >>> import os > > >>&g

file.read() doesn't read the whole file

2009-03-19 Thread Sreejith K
Hi, >>> snapdir = './mango.txt_snaps' >>> snap_cnt = 1 >>> block = 0 >>> import os >>> os.chdir('/mnt/gfs_local') >>> snap = open(snapdir + '/snap%s/%s' % (repr(snap_cnt), repr(block)),'r') >>> snap.read() 'dfdfdgagdfgdf\ngdgfadgagadg\nagafg\n\nfs\nf\nsadf\n\nsdfsdfsadf\n' >>> snapdir + '/snap%s/%

Creating a 256 byte/block filesystem using FUSE in python

2009-03-16 Thread Sreejith K
Anyone got any idea of how to create a 256 byte/block filesystem using FUSE in python ? How to implement block level reads/writes instead of byte level reads/writes in fuse-python ? -- http://mail.python.org/mailman/listinfo/python-list

Flags in fuse python

2009-03-16 Thread Sreejith K
Hi, I'm writing a file system under fuse-python. The main problem I'm facing now is that the flags which are provided by the fuse module when r/w are called, are screwing up the situation. I wrote a file class for fuse as shown below. class FlusterFile(object): def __init__(self,