Python Forum
redirect STDIO in the Python code
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
redirect STDIO in the Python code
#6
(Jul-01-2023, 12:48 AM)Skaperen Wrote: when any Python library forks a new process, does it make whatever is in sys.stdout, which may be using some other fd, such as fd 6, instead of fd 1, become fd 1
There is a lot of confusion here because you are mixing low-level concepts that belong to the C implementation of Python (such as file descriptors) with high-level concepts such as sys.stdin and sys.stdout which are abstract Python file objects that don't even need a file descriptor. The original question is too broad. If you want to do OS level operations in CPython, then use the available functions in modules such as os and subprocess. Most of what you do in C can be done in CPython, you are allowed to use functions such as os.fork or os.dup2, etc.
Reply


Messages In This Thread
redirect STDIO in the Python code - by Skaperen - Jun-23-2023, 01:32 AM
RE: redirect STDIO in the Python code - by Skaperen - Jun-27-2023, 11:12 PM
RE: redirect STDIO in the Python code - by Skaperen - Jul-01-2023, 12:48 AM
RE: redirect STDIO in the Python code - by Gribouillis - Jul-01-2023, 08:43 AM
RE: redirect STDIO in the Python code - by Skaperen - Jul-05-2023, 12:23 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  stderr redirect to file fmr300 2 3,728 Apr-03-2021, 01:31 AM
Last Post: fmr300
  Cannot redirect print to a file tester_V 3 2,587 Sep-11-2020, 12:21 AM
Last Post: tester_V
  redirect url_for passing arguments with the url Leon79 1 1,712 Jul-09-2020, 05:20 PM
Last Post: Leon79
  Redirect to __stdout__ fails in IDLE shell Pavel_47 1 2,014 Apr-13-2020, 05:13 PM
Last Post: deanhystad
  Redirect to file vndywarhol 1 2,356 Aug-23-2018, 11:01 AM
Last Post: DeaD_EyE
  Python redirect users to another url after form post blsturgeon 5 19,162 Jun-28-2018, 11:53 PM
Last Post: gontajones
  Script for media content and redirect in to a file puneet102 0 2,400 May-22-2018, 12:06 PM
Last Post: puneet102

Forum Jump:

User Panel Messages

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