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.

Title: The order of interactive prompt and traceback on Windows
Type: behavior Stage: resolved
Components: Windows Versions: Python 3.3
Status: closed Resolution: out of date
Dependencies: Superseder:
Assigned To: Nosy List: Drekin, iritkatriel, r.david.murray
Priority: normal Keywords:

Created on 2013-08-26 09:05 by Drekin, last changed 2022-04-11 14:57 by admin. This issue is now closed.

Messages (7)
msg196192 - (view) Author: Adam Bartoš (Drekin) * Date: 2013-08-26 09:05
On Windows, Python 3.3.2, when I run Python as a subprocess via Popen("py -i", stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate() and ends with exception, there is first interactive promt ">>>" in stderr output and then the traceback which is reversed to standard order when is run interactively directly.

Corresponding StackOverflow question: .
msg196216 - (view) Author: R. David Murray (r.david.murray) * (Python committer) Date: 2013-08-26 15:51
For anyone who wants to look in to this: according to the stack overflow question and comments, this is a behavior change between python2 and python3.
msg247461 - (view) Author: Adam Bartoš (Drekin) * Date: 2015-07-27 11:20
Yes, it is a behavior change between Python 2 and Python 3. I just tried with 2.7 and 3.0.
msg381048 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-11-16 00:22
On version 3.10, windows 10 I don't see this - the prompt comes after the traceback.

Adam, are you seeing this issue on any python version >= 3.8?
msg381170 - (view) Author: Adam Bartoš (Drekin) * Date: 2020-11-16 22:04
So far I could reproduce the issue on Python 3.7, Windows Vista 64bit. I'll try with newer versions.

The output I got:
>>> from subprocess import *
>>> Popen("py -i", stdin=PIPE, stdout=PIPE, stderr=PIPE).communicate()
(b'', b'>>> Traceback (most recent call last):\r\n  File "", line 2, in <module>\r\n    1/0\r\nZeroDivisionError: division by zero\r\n\r\n')
msg381449 - (view) Author: Adam Bartoš (Drekin) * Date: 2020-11-19 18:12
The order is fine on Python 3.8, Windows 10.
msg381450 - (view) Author: Irit Katriel (iritkatriel) * (Python committer) Date: 2020-11-19 18:17
Thanks. I'm closing this because 3.7 is only getting security fixes now.
Date User Action Args
2022-04-11 14:57:50adminsetgithub: 63038
2020-11-19 18:17:25iritkatrielsetstatus: open -> closed
resolution: out of date
messages: + msg381450

stage: resolved
2020-11-19 18:12:50Drekinsetmessages: + msg381449
2020-11-16 22:04:38Drekinsetstatus: pending -> open

messages: + msg381170
2020-11-16 00:22:09iritkatrielsetstatus: open -> pending
nosy: + iritkatriel
messages: + msg381048

2015-07-27 11:20:57Drekinsetmessages: + msg247461
2013-08-26 15:51:59r.david.murraysetnosy: + r.david.murray
messages: + msg196216
2013-08-26 09:05:07Drekincreate