Python Forum
should i use os.poll() for 2 reads?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
should i use os.poll() for 2 reads?
#1
i can't remember how long ago i asked this, but i don't think i got an answer and that may be because i asked in a poor way. i want to read from 2 (or more) pipes from one or more child processes. it could be from 2 separate processes. it could be from 1 process to which there are 2 pipes open, such as the other process' stdout and stderr. but the process i would be coding won't know which pipe will have data ready for reading. i could try to do this like i would do it in that infamous one letter named language. but i am hoping Python offers something better. if it does, i just haven't figured out where it is, yet. i'm still frequently led to the os module for systems stuff, but not all syscalls are accessed there. and for most of the things i am doing this is probably the wrong place to look, even if a solution is there.

so i am looking for a good lead in the right direction. surely, google has many. but, that is what makes it so bad. google can show you dozens of wrong ways to do something.

edit:

oops! there is no os.poll.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply
#2
I would use multiprocessing to
Quote:Start a process to read from 2 (or more) pipes
and read from the second pipe from the program. Provide an example if you want more specific info.
Reply
#3
i have no example, yet. i am doing planning first. but, i will focus on multiprocessing. thanks for the lead.
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Need help improving function that reads file into list of tuples t4keheart 6 3,063 Nov-03-2020, 04:58 AM
Last Post: ndc85430
  multiprocessing Pipe.poll very slow seandepagnier 0 2,358 Mar-09-2020, 03:10 AM
Last Post: seandepagnier

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020