This issue tracker has been migrated to GitHub, and is currently read-only.
For more information, see the GitHub FAQs in the Python's Developer Guide.

classification
Title: Pythonwin : close() on a stdout
Type: Stage:
Components: IDLE Versions: Python 2.2
process
Status: closed Resolution: wont fix
Dependencies: Superseder:
Assigned To: kbk Nosy List: balthus, kbk
Priority: normal Keywords:

Created on 2002-11-25 14:28 by balthus, last changed 2022-04-10 16:05 by admin. This issue is now closed.

Messages (3)
msg13458 - (view) Author: Xavier Bassery (balthus) Date: 2002-11-25 14:28
I need to treat file objects and sys.stdout object as one.
So I can write a class that writes likewise in a file
or to standard output.

The problem came when I called the close() method of an
sys.stdout object.
I've seen that in Pythonwin, sys.stdout has such a method.
This is not the case in the standard python.

And calling it causes that :

File
"C:\Python22\lib\site-packages\Pythonwin\pywin\scintilla\document.py",
line 153, in __call__
    return apply(getattr(v, self.name), (std, extra))
AttributeError: OnBraceMatch
win32ui: Exception in OnNotify() handler


I know that the right way to go is to avoid using the
close() method.
But methinks it's a bug that the method is available in
the IDE of pythonwin.
msg13459 - (view) Author: Xavier Bassery (balthus) Date: 2002-11-25 14:38
Logged In: YES 
user_id=653276

>> sys.stdout has such a method.
>> This is not the case in the standard python

I was not completely right here, in console mode there is
the close() methode for sys.stdout object.
It's not the case in the IDLE !

msg13460 - (view) Author: Kurt B. Kaiser (kbk) * (Python committer) Date: 2003-07-10 05:38
Logged In: YES 
user_id=149084

Closing the stdout is not very helpful, as you will see
if you try it in the interactive interpreter.

Take a look at IDLE's PyShell.py for a way to use
Pseudofiles, this may help you.

We don't deal with Pythonwin.
History
Date User Action Args
2022-04-10 16:05:56adminsetgithub: 37533
2002-11-25 14:28:15balthuscreate