Sign Up

Sign Up to our social questions and Answers Engine to ask questions, answer people’s questions, and connect with other people.

Have an account? Sign In

Have an account? Sign In Now

Sign In

Login to our social questions & Answers Engine to ask questions answer people’s questions & connect with other people.

Sign Up Here

Forgot Password?

Don't have account, Sign Up Here

Forgot Password

Lost your password? Please enter your email address. You will receive a link and will create a new password via email.

Have an account? Sign In Now

You must login to ask a question.

Forgot Password?

Need An Account, Sign Up Here

Please briefly explain why you feel this question should be reported.

Please briefly explain why you feel this answer should be reported.

Please briefly explain why you feel this user should be reported.

Sign InSign Up

The Archive Base

The Archive Base Logo The Archive Base Logo

The Archive Base Navigation

  • SEARCH
  • Home
  • About Us
  • Blog
  • Contact Us
Search
Ask A Question

Mobile menu

Close
Ask a Question
  • Home
  • Add group
  • Groups page
  • Feed
  • User Profile
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Buy Points
  • Users
  • Help
  • Buy Theme
  • SEARCH
Home/ Questions/Q 8303487
In Process

The Archive Base Latest Questions

Editorial Team
  • 0
Editorial Team
Asked: June 8, 20262026-06-08T17:33:26+00:00 2026-06-08T17:33:26+00:00

I have a feeling its not possible; but is there a way to set

  • 0

I have a feeling its not possible; but is there a way to set a read timeout on an anonymous pipe in Python / C on Linux?

Are there better options than setting and trapping a SIGALRM?

>>> import os
>>> output, input = os.pipe()
>>> outputfd = os.fdopen(output, 'r')
>>> dir(outputfd)
['__class__', '__delattr__', '__doc__', '__enter__', '__exit__', '__format__', '__getattribute__', '__hash__', '__init__', '__iter__', '__new__', '__reduce__', '__reduce_ex__', '__repr__', '__setattr__', '__sizeof__', '__str__', '__subclasshook__', 'close', 'closed', 'encoding', 'errors', 'fileno', 'flush', 'isatty', 'mode', 'name', 'newlines', 'next', 'read', 'readinto', 'readline', 'readlines', 'seek', 'softspace', 'tell', 'truncate', 'write', 'writelines', 'xreadlines']
>>> 

(no settimeout() method)

  • 1 1 Answer
  • 0 Views
  • 0 Followers
  • 0
Share
  • Facebook
  • Report

Leave an answer
Cancel reply

You must login to add an answer.

Forgot Password?

Need An Account, Sign Up Here

1 Answer

  • Voted
  • Oldest
  • Recent
  • Random
  1. Editorial Team
    Editorial Team
    2026-06-08T17:33:28+00:00Added an answer on June 8, 2026 at 5:33 pm

    You should try using the select module, which does allow you to provide a timeout. Add the file object to the select set, and then examine the return object to see if it’s changed:

    r, w, x = select.select([output], [], [], timeout)
    

    Then examine r to see if the object is readable. This can be extended to as many objects you want to monitor. If the object is in r, then do a read: output.read().

    Also, you may wish to use os.read, rather than fdopen, as it will not be subject to the whims of Python’s file buffering.

    • 0
    • Reply
    • Share
      Share
      • Share on Facebook
      • Share on Twitter
      • Share on LinkedIn
      • Share on WhatsApp
      • Report

Sidebar

Related Questions

I have a feeling I'm going about this all wrong. But anyway. I have
I have a feeling this XML is not valid, can someone please explain why?
I have the feeling the answer to this question is no but I figured
I have a feeling this is a stupid question but I can't find the
I have a feeling I am completely borking this MySQL query but I'll ask
I have a feeling its due to the differences in PHP version installed. The
Here is what I would like to do. Not sure if its possible with
I have a feeling I'm asking a stupid question here. I'm having trouble retrieving
I have a feeling I already know the answer people are going to give,
I have a feeling that this query is pretty easy to construct, I just

Explore

  • Home
  • Add group
  • Groups page
  • Communities
  • Questions
    • New Questions
    • Trending Questions
    • Must read Questions
    • Hot Questions
  • Polls
  • Tags
  • Badges
  • Users
  • Help
  • SEARCH

Footer

© 2021 The Archive Base. All Rights Reserved
With Love by The Archive Base

Insert/edit link

Enter the destination URL

Or link to existing content

    No search term specified. Showing recent items. Search or use up and down arrow keys to select an item.