From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.io!.POSTED.blaine.gmane.org!not-for-mail From: Eli Zaretskii Newsgroups: gmane.emacs.bugs Subject: bug#55119: 27.2; Inferior Python/ M-x run-python problem with Tk on Windows Date: Tue, 26 Apr 2022 14:14:02 +0300 Message-ID: <83a6c8m70l.fsf@gnu.org> References: <87sfq0ebip.fsf@robertthorpeconsulting.com> Injection-Info: ciao.gmane.io; posting-host="blaine.gmane.org:116.202.254.214"; logging-data="16696"; mail-complaints-to="usenet@ciao.gmane.io" Cc: 55119@debbugs.gnu.org To: Robert Thorpe Original-X-From: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Tue Apr 26 13:19:57 2022 Return-path: Envelope-to: geb-bug-gnu-emacs@m.gmane-mx.org Original-Received: from lists.gnu.org ([209.51.188.17]) by ciao.gmane.io with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.92) (envelope-from ) id 1njJEb-0004B7-9d for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Apr 2022 13:19:57 +0200 Original-Received: from localhost ([::1]:45810 helo=lists1p.gnu.org) by lists.gnu.org with esmtp (Exim 4.90_1) (envelope-from ) id 1njJEZ-0001Ne-NA for geb-bug-gnu-emacs@m.gmane-mx.org; Tue, 26 Apr 2022 07:19:55 -0400 Original-Received: from eggs.gnu.org ([2001:470:142:3::10]:45916) by lists.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njJ9q-0003Ih-89 for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 07:15:02 -0400 Original-Received: from debbugs.gnu.org ([209.51.188.43]:43320) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_128_GCM_SHA256:128) (Exim 4.90_1) (envelope-from ) id 1njJ9p-0006na-U2 for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 07:15:01 -0400 Original-Received: from Debian-debbugs by debbugs.gnu.org with local (Exim 4.84_2) (envelope-from ) id 1njJ9p-000439-Pm for bug-gnu-emacs@gnu.org; Tue, 26 Apr 2022 07:15:01 -0400 X-Loop: help-debbugs@gnu.org Resent-From: Eli Zaretskii Original-Sender: "Debbugs-submit" Resent-CC: bug-gnu-emacs@gnu.org Resent-Date: Tue, 26 Apr 2022 11:15:01 +0000 Resent-Message-ID: Resent-Sender: help-debbugs@gnu.org X-GNU-PR-Message: followup 55119 X-GNU-PR-Package: emacs Original-Received: via spool by 55119-submit@debbugs.gnu.org id=B55119.165097166315358 (code B ref 55119); Tue, 26 Apr 2022 11:15:01 +0000 Original-Received: (at 55119) by debbugs.gnu.org; 26 Apr 2022 11:14:23 +0000 Original-Received: from localhost ([127.0.0.1]:37217 helo=debbugs.gnu.org) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njJ9D-0003ze-8q for submit@debbugs.gnu.org; Tue, 26 Apr 2022 07:14:23 -0400 Original-Received: from eggs.gnu.org ([209.51.188.92]:52458) by debbugs.gnu.org with esmtp (Exim 4.84_2) (envelope-from ) id 1njJ9B-0003zK-VV for 55119@debbugs.gnu.org; Tue, 26 Apr 2022 07:14:22 -0400 Original-Received: from fencepost.gnu.org ([2001:470:142:3::e]:58004) by eggs.gnu.org with esmtps (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njJ96-0006jC-7l; Tue, 26 Apr 2022 07:14:16 -0400 DKIM-Signature: v=1; a=rsa-sha256; q=dns/txt; c=relaxed/relaxed; d=gnu.org; s=fencepost-gnu-org; h=References:Subject:In-Reply-To:To:From:Date: mime-version; bh=PrjdtNdCOeOu/BD6QP4/Oa4yipbDrwbFukzReI2k6uw=; b=sblFvl6gIdc5 ya7r47GMU0k5byUitx5BithBW472RtLveo5BmLFj3QS4jCJZp5OL1tzdLHVc7vEkgYGXWM/m0MB49 7K3icGkNvVT/HekFKfgd8im2HjTpvG6rKkh+PLNcSKS44FumuA1FSamNao+vNSEpn820559HmJT0f POpa7F+R5Z7119WWIh5QL6lgNzUV/hQ9e4CvFIxYXxHhFcI023PQPYUutsKCm2JUOBMO6uIbRSY1t /CBau3KEKGumOpTD3OzDQPD9M0dwMAZRGhQinpUqQS/AwTO/zct65rNIiEDKnvgdUqbZKkelPJFtJ IjHogZUz+G/55WTaMgaT5g==; Original-Received: from [87.69.77.57] (port=3820 helo=home-c4e4a596f7) by fencepost.gnu.org with esmtpsa (TLS1.2:ECDHE_RSA_AES_256_GCM_SHA384:256) (Exim 4.90_1) (envelope-from ) id 1njJ95-00084z-LD; Tue, 26 Apr 2022 07:14:15 -0400 In-Reply-To: <87sfq0ebip.fsf@robertthorpeconsulting.com> (message from Robert Thorpe on Tue, 26 Apr 2022 05:03:58 +0100) X-BeenThere: debbugs-submit@debbugs.gnu.org X-Mailman-Version: 2.1.18 Precedence: list X-BeenThere: bug-gnu-emacs@gnu.org List-Id: "Bug reports for GNU Emacs, the Swiss army knife of text editors" List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Errors-To: bug-gnu-emacs-bounces+geb-bug-gnu-emacs=m.gmane-mx.org@gnu.org Original-Sender: "bug-gnu-emacs" Xref: news.gmane.io gmane.emacs.bugs:230702 Archived-At: > From: Robert Thorpe > Date: Tue, 26 Apr 2022 05:03:58 +0100 > > I have a problem with M-x run-python on Windows 10 enterprise. > > The python code I'm working on uses Tk. Unfortunately, after Tk is used > the inferior python no longer responds to inputs. I see one more > prompt, then nothing at all. > > Type the following into an inferior python process. Or alternatively, > put it in a file and import it. > > import tkinter as tk > from tkinter import ttk > window = tk.Tk() > > This pops up a Tk window with nothing in it. It also gives another > python prompt. But after that communication between Emacs and the > inferior python process seems to be lost. Unless there's someone here who uses this configuration on Windows, knows the details, and can dig into the problem, you'll have to tell more about what the above does, from the technical POV. It is likely some snafu with I/O between Emacs and Python when it uses Tcl/Tk, but what exactly and whether it's at all solvable, is anybody's guess at this point. All I can tell you is that Emacs on Windows uses a bidirectional pipe to communicate with subprocesses, so if the above fiddles with standard I/O streams in some non-trivial ways, or assumes it can separate input device from output device, or redirect them separately to different places, or even that one or both of them are or can be made unbuffered -- it will simply fail to work on Windows. You have a single bidirectional pipe which is buffered by the OS, and at least Python (or any other external program) will see that its standard I/O is not connected to a console device, and will (mis)behave accordingly. The buffering issue you could perhaps deal with, by telling Python to use unbuffered I/O. But I'm not even sure this is the root cause of what you see. That is all I can tell without more detail, sorry.