Problem using lseek

Padraig at Linux.ie Padraig at Linux.ie
Wed Feb 5 11:29:51 EST 2003


Michael Mayhew wrote:
> Greetings,
> 
>     I have been using Python faithfully for the past five months and am 
> quite happy having learned it. That being said, I am currently having a 
> real honey of a problem. I am trying to use the os module's lseek 
> function to set a file descriptor to a new offset position in a file. 
> However, when running the code through the interpreter, I continue 
> receiving a TypeError message:
> 
> Traceback (most recent call last):
>   File "testseq.py", line 18, in ?
>     os.lseek(somefile, someoffset, 1)
> TypeError: an integer is required

Is this what you want?
os.lseek(somefile.fileno(), someoffset, 1)

note also:
somefile.seek()

Pádraig.





More information about the Python-list mailing list