classification
Title: AttributeError: module 'sys' has no attribute 'original_stdout'
Type: Stage: resolved
Components: Versions:
process
Status: closed Resolution: not a bug
Dependencies: Superseder:
Assigned To: Nosy List: chinmay.malvania, steven.daprano, terry.reedy
Priority: normal Keywords:

Created on 2021-05-30 00:18 by chinmay.malvania, last changed 2021-06-04 18:47 by terry.reedy. This issue is now closed.

Messages (3)
msg394746 - (view) Author: Chinmay Malvania (chinmay.malvania) Date: 2021-05-30 00:18
I imported sys but when I use it, it says:
AttributeError: module 'sys' has no attribute 'original_stdout'
msg394747 - (view) Author: Steven D'Aprano (steven.daprano) * (Python committer) Date: 2021-05-30 00:35
Correct, sys has no attribute 'original_stdout'.

Do you have a file called `sys.py`? Rename it.
msg395111 - (view) Author: Terry J. Reedy (terry.reedy) * (Python committer) Date: 2021-06-04 18:47
If you intend to import the stdlib sys and succeed, the original stdout is called '__stdout__'.  See 
https://docs.python.org/3/library/sys.html#sys.__stdin__, including the note that it may be None on Windows.  Also peruse that doc to see what attributes sys *does* have.

When you have questions about using python, please post first to python-list or other question-answering forums.
History
Date User Action Args
2021-06-04 18:47:29terry.reedysetstatus: open -> closed

nosy: + terry.reedy
messages: + msg395111

resolution: not a bug
stage: resolved
2021-05-30 00:35:22steven.dapranosetnosy: + steven.daprano
messages: + msg394747
2021-05-30 00:18:39chinmay.malvaniacreate