Help | Site Map
Connecting Tech Pros Worldwide
 
 
LinkBack Thread Tools
  #1  
Old July 18th, 2005, 07:42 PM
Steven
Guest
 
Posts: n/a
Default looking for blocking on read of a real file (not socket or pipe)

Hello,
I'm seeking a read method that will block until new data is available. Is
there such a python function that does that?

Thanks,

Steven Howe
  #2  
Old July 18th, 2005, 07:43 PM
Fredrik Lundh
Guest
 
Posts: n/a
Default Re: looking for blocking on read of a real file (not socket or pipe)

"Steven" <steven.howe@verizon.net> wrote:
[color=blue]
> I'm seeking a read method that will block until new data is available. Is
> there such a python function that does that?[/color]

read until end of file, wait a while, seek to position you tried to read from
when you reached the end, and read again. see:

http://aspn.activestate.com/ASPN/Coo.../Recipe/157035

(also see the comments, but ignore the last one; he is missing something)

</F>



  #3  
Old July 18th, 2005, 07:44 PM
Peter Hansen
Guest
 
Posts: n/a
Default Re: looking for blocking on read of a real file (not socket or pipe)

Steven wrote:[color=blue]
> I'm seeking a read method that will block until new data is available. Is
> there such a python function that does that?[/color]

It may be relevant which platform(s) are of interest. Linux?
Mac? Windows? All? The more cross-platform this needs to
be, the less likely it exists...
  #4  
Old July 18th, 2005, 07:44 PM
elbertlev@hotmail.com
Guest
 
Posts: n/a
Default Re: looking for blocking on read of a real file (not socket or pipe)

I doubt that the recipe you recomended will work at all in the case of
different processes. To do this right file has to be open in shared
mode (by both programs). Python does not support shared access.
In the case of one program, but different threads probably this will
work.

  #5  
Old July 18th, 2005, 07:44 PM
Fredrik Lundh
Guest
 
Posts: n/a
Default Re: looking for blocking on read of a real file (not socket or pipe)

<elbertlev@hotmail.com> wrote:
[color=blue]
> I doubt that the recipe you recomended will work at all in the case of
> different processes. To do this right file has to be open in shared
> mode (by both programs). Python does not support shared access.
> In the case of one program, but different threads probably this will
> work.[/color]

do you always assume that everyone uses the same operating system as
you do? (even if the user agent they used to post the message doesn't run
on your operating system... ;-)

</F>



 

Bookmarks

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are Off
[IMG] code is Off
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are On

What is Bytes?

We are a network of experts and professionals in IT and software development that help one another with answers to tough questions and share insights. Get the best answers to your questions from over network members.
Post your question now . . .
It's fast and it's free

Popular Articles