Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > looking for blocking on read of a real file (not socket or pipe)

Reply
Thread Tools

looking for blocking on read of a real file (not socket or pipe)

 
 
Steven
Guest
Posts: n/a
 
      12-13-2004
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
 
Reply With Quote
 
 
 
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-13-2004
"Steven" <> wrote:

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


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>



 
Reply With Quote
 
 
 
 
Peter Hansen
Guest
Posts: n/a
 
      12-14-2004
Steven wrote:
> I'm seeking a read method that will block until new data is available. Is
> there such a python function that does that?


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...
 
Reply With Quote
 
elbertlev@hotmail.com
Guest
Posts: n/a
 
      12-14-2004
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.

 
Reply With Quote
 
Fredrik Lundh
Guest
Posts: n/a
 
      12-14-2004
<> wrote:

> 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.


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>



 
Reply With Quote
 
 
 
Reply

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 On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
socket.unbind or socket.unlisten? - socket.error: (48, 'Addressalready in use') Laszlo Nagy Python 1 01-27-2009 05:05 PM
Non blocking socket keep blocking on read ? Serge Savoie Ruby 4 10-01-2008 03:16 PM
read/select not blocking on SSL socket? yermej@gmail.com Ruby 3 08-31-2007 01:59 AM
FTP socket command read blocking on passive RETR get Eric Java 0 03-04-2005 06:35 PM
socket.sendall(), non-blocking sockets, and multi-threaded socket sending Tim Black Python 1 08-03-2004 01:11 PM



Advertisments
 



1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57