From mboxrd@z Thu Jan 1 00:00:00 1970 Path: news.gmane.org!not-for-mail From: "Paul Molodowitch" Newsgroups: gmane.emacs.devel,gmane.emacs.pretest.bugs Subject: 23.0.50; pychecker (via python-check) hangs when python script reads input on windows Date: Thu, 8 Nov 2007 02:30:31 -0800 Message-ID: NNTP-Posting-Host: lo.gmane.org Mime-Version: 1.0 Content-Type: multipart/mixed; boundary="----=_Part_46146_6303397.1194517831937" X-Trace: ger.gmane.org 1194553052 14957 80.91.229.12 (8 Nov 2007 20:17:32 GMT) X-Complaints-To: usenet@ger.gmane.org NNTP-Posting-Date: Thu, 8 Nov 2007 20:17:32 +0000 (UTC) To: emacs-pretest-bug@gnu.org Original-X-From: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Thu Nov 08 21:17:26 2007 Return-path: Envelope-to: ged-emacs-devel@m.gmane.org Original-Received: from lists.gnu.org ([199.232.76.165]) by lo.gmane.org with esmtp (Exim 4.50) id 1IqDn9-0002UR-Oz for ged-emacs-devel@m.gmane.org; Thu, 08 Nov 2007 21:15:56 +0100 Original-Received: from localhost ([127.0.0.1] helo=lists.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1IqDmy-0008E8-0O for ged-emacs-devel@m.gmane.org; Thu, 08 Nov 2007 15:15:44 -0500 Original-Received: from mailman by lists.gnu.org with tmda-scanned (Exim 4.43) id 1Iq4eq-0005Zj-LC for emacs-devel@gnu.org; Thu, 08 Nov 2007 05:30:44 -0500 Original-Received: from exim by lists.gnu.org with spam-scanned (Exim 4.43) id 1Iq4eo-0005YJ-SR for emacs-devel@gnu.org; Thu, 08 Nov 2007 05:30:43 -0500 Original-Received: from [199.232.76.173] (helo=monty-python.gnu.org) by lists.gnu.org with esmtp (Exim 4.43) id 1Iq4eo-0005Y2-J5 for emacs-devel@gnu.org; Thu, 08 Nov 2007 05:30:42 -0500 Original-Received: from fencepost.gnu.org ([140.186.70.10]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iq4eo-0000Gm-1y for emacs-devel@gnu.org; Thu, 08 Nov 2007 05:30:42 -0500 Original-Received: from mx10.gnu.org ([199.232.76.166]) by fencepost.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iq4en-0003L0-Gj for emacs-pretest-bug@gnu.org; Thu, 08 Nov 2007 05:30:41 -0500 Original-Received: from Debian-exim by monty-python.gnu.org with spam-scanned (Exim 4.60) (envelope-from ) id 1Iq4el-0000GE-LB for emacs-pretest-bug@gnu.org; Thu, 08 Nov 2007 05:30:41 -0500 Original-Received: from fk-out-0910.google.com ([209.85.128.188]) by monty-python.gnu.org with esmtp (Exim 4.60) (envelope-from ) id 1Iq4ek-0000Fl-UX for emacs-pretest-bug@gnu.org; Thu, 08 Nov 2007 05:30:39 -0500 Original-Received: by fk-out-0910.google.com with SMTP id 19so156371fkr for ; Thu, 08 Nov 2007 02:30:36 -0800 (PST) DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=beta; h=domainkey-signature:received:received:message-id:date:from:to:subject:mime-version:content-type; bh=tGR7HwCrU+e+2RcnvW/rZFloIx2hiVi1wqYs7TMkSMU=; b=qFM35AA7eBEavjmwHjYzM4KUFsxSoN0/c7tNbz5oznEXMtpdGw2poJ9WCmFTIjY8msq8x0jKwudapk+zQWevyWdG+3gZD3rs89W9/Yl8bCtvwhC9AZvaRWzKQy0B6dOMV38QLjxEPcowGDXBqvDW5Vt+FZDwAw8aNuuyvXzL9Rs= DomainKey-Signature: a=rsa-sha1; c=nofws; d=gmail.com; s=beta; h=received:message-id:date:from:to:subject:mime-version:content-type; b=Kb0IaluGgvr2N6YfGMZHq2BqJJweNmwlFUnDgpdGWq9FFQaCJtxMy5GPl2rlorWyylJIIXiuldr27qMeGrK4wdvb5T5l+/6WChOmnuvwChvAbkkHkMZeemNUrY5HDtnU+9XgLULds5YyK10mSgI7/w8GYMajUa2YgWLYaw9A+EE= Original-Received: by 10.82.177.3 with SMTP id z3mr937009bue.1194517831941; Thu, 08 Nov 2007 02:30:31 -0800 (PST) Original-Received: by 10.82.100.20 with HTTP; Thu, 8 Nov 2007 02:30:31 -0800 (PST) X-detected-kernel: by monty-python.gnu.org: Linux 2.6 (newer, 2) X-detected-kernel: by monty-python.gnu.org: Linux 2.6, seldom 2.4 (older, 4) X-Mailman-Approved-At: Thu, 08 Nov 2007 15:15:39 -0500 X-BeenThere: emacs-devel@gnu.org X-Mailman-Version: 2.1.5 Precedence: list List-Id: "Emacs development discussions." List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Original-Sender: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Errors-To: emacs-devel-bounces+ged-emacs-devel=m.gmane.org@gnu.org Xref: news.gmane.org gmane.emacs.devel:82821 gmane.emacs.pretest.bugs:20255 Archived-At: ------=_Part_46146_6303397.1194517831937 Content-Type: multipart/alternative; boundary="----=_Part_46147_10627233.1194517831938" ------=_Part_46147_10627233.1194517831938 Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline --text follows this line-- In windows, when I invoke python-check on a script such as the following: ---Python Script START--- # This is just here to check that clicking on a warning # in the compilation window still takes us to the correct # line number if False: nonExistant("I should raise a warning") raw_input("\n" \ "This will hang pychecker in emacs...\n" \ "Press enter to exit...") ---Python Script END--- then the emacs compilation buffer seems to hang forever - it is waiting for user input, but since the buffer is read only, there is no way to give it any. I tried changing python-check to: (defun python-check (command) "Check a Python file (default current buffer's file). Runs COMMAND, a shell command, as if by `compile'. See `python-check-command' for the default." (interactive (list (read-string "Checker command: " (or python-saved-check-command (concat python-check-command " " (let ((name (buffer-file-name))) (if name (file-name-nondirectory name)))))))) (setq python-saved-check-command command) (require 'compile) ;To define compilation-* variables. (save-some-buffers (not compilation-ask-about-save) nil) (let ((compilation-error-regexp-alist (cons '("(\\([^,]+\\), line \\([0-9]+\\))" 1 2) compilation-error-regexp-alist))) (compilation-start command t))) - the only difference being the final line, line 1142, is changed from: (compilation-start command))) to: (compilation-start command t))) By putting the output buffer in comint-mode, the buffer at least now accept= s input, so we can press enter, unfreeze it, and we can see our results (and even still click on the line numbers, etc). However, this is a sort of crappy solution, as it hasn't updated the buffer to display the prompt at the point when it is actually waiting for input - ie, I see: ---Buffer display START--- -*- mode: compilation; default-directory: "c:/Documents and Settings/Elrond/Desktop/" -*- Comint started at Thu Nov 08 01:28:37 C:\Dev\Python25\pychecker-0.8.17\build\scripts-2.5\pychecker.bat --stdlib emacs_pychecker_bug.py c:\Documents and Settings\Elrond\Desktop>C:\Dev\Python25\python.exe C:\Dev\Python25\Lib\site-packages\pychecker\checker.py --stdlib emacs_pychecker_bug.py ---Buffer display END--- ...when it is supposed to be prompting me to press enter. (Incidentally, this is also the output I see without the change to python-check). It appears that the real culprit in this case is not in python.el, but somewhere in the implementation of process input/output piping on windows - if I simply start up a shell, and invoke pychecker on our script from there= , we get the same behavior. I've only tried this on a windows XP system... Now, for some fun information about my environment: OS: Microsoft Windows XP Professional x64 Edition Version 2003 Service Pack 2 Python version: Python 2.5.1 (r251:54863, Apr 18 2007, 09:02:36) [MSC v.1400 64 bit (AMD64)= ] on win32 Pychecker version: 0.8.17 configure command: configure --with-gcc --cflags -I%imglib-dir% --no-cygwin --cflags -mno-cygwin And here's the stuff that report-emacs-bug gave: In GNU Emacs 23.0.50.1 (i386-mingw-nt5.2.3790) of 2007-11-07 on DEINONYCHUS Windowing system distributor `Microsoft Corp.', version 5.2.3790 configured using `configure --with-gcc (3.4) --cflags -IC:DevProjects=1Bmac= s timageLibs -mno-cygwin' Important settings: value of $LC_ALL: nil value of $LC_COLLATE: nil value of $LC_CTYPE: nil value of $LC_MESSAGES: nil value of $LC_MONETARY: nil value of $LC_NUMERIC: nil value of $LC_TIME: nil value of $LANG: ENU locale-coding-system: cp1252 default-enable-multibyte-characters: t Major mode: Python Minor modes in effect: eldoc-mode: t show-paren-mode: t cua-mode: t recentf-mode: t tooltip-mode: t tool-bar-mode: t mouse-wheel-mode: t menu-bar-mode: t file-name-shadow-mode: t global-font-lock-mode: t font-lock-mode: t blink-cursor-mode: t unify-8859-on-encoding-mode: t utf-translate-cjk-mode: t auto-compression-mode: t column-number-mode: t line-number-mode: t transient-mark-mode: t Recent input: C-s C-x C-k C-x C-k x r e p o r t p y c h e c k e r SPC h a n g s SPC C-h k p y c h e c k e r SPC ( p y t h o n - c h e c k - c o m m a n d ) SPC h a n d g s SPC w h e n SPC p y t h o n SPC s c r i p t SPC n e e d s SPC i n p r e a d s SPC i n c a l l s SPC SPC r e a d s SPC i n p u t C-x C-k C-h C-v C-c C-v x e Recent messages: Loading c:/Documents and Settings/Elrond/UnixHome/.recentf...done Cleaning up the recentf list...done (0 removed) For information about GNU Emacs and the GNU system, type C-h C-a. Fontifying *Python*... (regexps...........) For information about GNU Emacs and the GNU system, type C-h C-a. Wrote c:/Documents and Settings/Elrond/Desktop/test.py Type C-x 1 to remove help window. byte-code: Beginning of buffer [2 times] (No files need saving) goto-history-element: Beginning of history; no preceding item ------=_Part_46147_10627233.1194517831938 Content-Type: text/html; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable Content-Disposition: inline
--text follows this line--

In windows, when I invoke python-chec= k on a script such as the following:

---Python Script START---
# This is just here to check that clicking on a warning
# in the compi= lation window still takes us to the correct
# line number
if False:
    nonExistant("I sh= ould raise a warning")

raw_input("\n" \
 &nbs= p;            "= This will hang pychecker in emacs...\n" \
    &= nbsp;         "Press enter to = exit...")

---Python Script END---

then the emacs compilation buffer se= ems to hang forever - it is waiting for user input, but since the buffer is= read only, there is no way to give it any.  I tried changing python-c= heck to:

(defun python-check (command)
  "Check a Python file (= default current buffer's file).
Runs COMMAND, a shell command, as if= by `compile'.
See `python-check-command' for the default."=
  (interactive
   (list (read-string "Checker comman= d: "
            =   (or python-saved-check-command
      &nb= sp;       (concat python-check-command " "               = ;   (let ((name (buffer-file-name)))
              &n= bsp;     (if name
        &= nbsp;           (file-name-nondirec= tory name))))))))
  (setq python-saved-check-command command)
&n= bsp; (require 'compile)        =             ;To defi= ne compilation-* variables.
  (save-some-buffers (not compilation-ask-about-save) nil)
&nbs= p; (let ((compilation-error-regexp-alist
     (cons = '("(\\([^,]+\\), line \\([0-9]+\\))" 1 2)
  &nbs= p;        compilation-error-regexp-alist)))
    (compilation-start command t)))

 - the o= nly difference being the final line, line 1142, is changed from:

&nb= sp;   (compilation-start command)))

to:

  = ;  (compilation-start command t)))

By putting the output buffer in comint-mode, the buffer at least now accept= s input, so we can press enter, unfreeze it, and we can see our results (an= d even still click on the line numbers, etc).  However, this is a sort= of crappy solution, as it hasn't updated the buffer to display the pro= mpt at the point when it is actually waiting for input - ie, I see:

---Buffer display START---

-*- mode: compilation; default-di= rectory: "c:/Documents and Settings/Elrond/Desktop/" -*-
Comin= t started at Thu Nov 08 01:28:37

C:\Dev\Python25\pychecker-0.8.17\bu= ild\scripts-2.5\pychecker.bat --stdlib emacs_pychecker_bug.py

c:\Documents and Settings\Elrond\De= sktop>C:\Dev\Python25\python.exe C:\Dev\Python25\Lib\site-packages\pyche= cker\checker.py --stdlib emacs_pychecker_bug.py

---Buffer display EN= D---

...when it is supposed to be prompting me to press enter. (Incident= ally, this is also the output I see without the change to python-check).
It appears that the real culprit in this case is not in python.el, but= somewhere in the implementation of process input/output piping on windows = - if I simply start up a shell, and invoke pychecker on our script from the= re, we get the same behavior.

I've only tried this on a windows XP system...

Now, for = some fun information about my environment:

OS: Microsoft Windows XP<= br>    Professional x64 Edition
    Versio= n 2003
    Service Pack 2

Python version:
Python 2.5.1 (r251:54863, Apr 18 2007, 09:02:36)= [MSC v.1400 64 bit (AMD64)] on win32

Pychecker version: 0.8.17
<= br>configure command:
configure --with-gcc --cflags -I%imglib-dir% --no-= cygwin --cflags -mno-cygwin

And here's the stuff that report-emacs-bug gave:

In GNU = Emacs 23.0.50.1 (i386-mingw-nt5.2.3790) of 2007-11-07 on DEINONYCHUS
Windowing system distributor `Micros= oft Corp.', version=20 5.2.3790
configured using `configure --with-gcc (3.4) --cflags -IC:DevPr= ojects=1Bmacs
timageLibs -mno-cygwin'

Important settings:
=   value of $LC_ALL: nil
  value of $LC_COLLATE: nil
  = value of $LC_CTYPE: nil
  value of $LC_MESSAGES: nil
  value of $LC_MONETARY: nil<= br>  value of $LC_NUMERIC: nil
  value of $LC_TIME: nil
&nb= sp; value of $LANG: ENU
  locale-coding-system: cp1252
  de= fault-enable-multibyte-characters: t

Major mode: Python

Minor modes in effect:
  eldoc-mo= de: t
  show-paren-mode: t
  cua-mode: t
  recentf-= mode: t
  tooltip-mode: t
  tool-bar-mode: t
  mous= e-wheel-mode: t
  menu-bar-mode: t
  file-name-shadow-mode: t
  global-font-lock-mode: t
&= nbsp; font-lock-mode: t
  blink-cursor-mode: t
  unify-8859= -on-encoding-mode: t
  utf-translate-cjk-mode: t
  auto-com= pression-mode: t
  column-number-mode: t
  line-number-mode: t
  transient-mark-mode: t

Rece= nt input:
<help-echo> <help-echo> <down-mouse-1> <m= ouse-1> <home>
<delete> C-s C-x C-k <help-echo> C-= x C-k <help-echo>=20
<help-echo> <drag-n-drop> <help-echo> <down-mouse-= 1>
<mouse-1> <escape> x r e p o r t <tab> <retu= rn> p y
c h e c k e r SPC h a n g s SPC <backspace> <backsp= ace>=20
<backspace> <backspace> <backspace> <backspace>= <backspace>
<backspace> <backspace> <backspace>= ; <backspace> <backspace>
<backspace> <backspace&g= t; <backspace> <backspace> <down-mouse-1>=20
<mouse-1> <help-echo> <down-mouse-1> <mouse-1> = C-h
k <help-echo> <help-echo> <help-echo> <help-ec= ho> <help-echo>
<help-echo> <help-echo> <help-e= cho> <help-echo> <help-echo>=20
<help-echo> <help-echo> <help-echo> <help-echo>= <help-echo>
<help-echo> <help-echo> <help-echo>= ; <help-echo> <help-echo>
<help-echo> <menu-bar>= ; <Python> <Check file> <help-echo>=20
<help-echo> <down-mouse-1> <mouse-1> <help-echo>= ; p
y c h e c k e r SPC ( p y t h o n - c h e c k - c o
m m a n d )= SPC h a n d <backspace> g s SPC w h e n
SPC p y t h o n SPC s c = r i p t SPC n e e d s SPC i=20
n p <backspace> <backspace> <backspace> <backspace= >
<backspace> <backspace> <backspace> <backspac= e> <backspace>
r e a d s SPC i n <backspace> <backspa= ce> <backspace>=20
<backspace> <backspace> <backspace> <backspace>= <backspace>
c a l l s SPC <backspace> <backspace> &l= t;backspace> <backspace>
<backspace> <backspace> &= lt;backspace> SPC r e a d s SPC=20
i n p u t <return> <help-echo> <down-mouse-1> <mou= se-movement>
<mouse-movement> <drag-mouse-1> <down-mo= use-1> <mouse-1>
<down-mouse-1> <mouse-1> <retu= rn> <return> <up> <wheel-down>=20
<wheel-down> <wheel-down> <wheel-down> <wheel-down= >
<wheel-up> <double-wheel-up> <wheel-up> <whee= l-down>
<double-wheel-down> <wheel-down> <wheel-down&= gt; <wheel-down>=20
<wheel-down> <wheel-down> <double-wheel-down> <whe= el-down>
<wheel-down> <wheel-up> <double-wheel-up>= <wheel-down>
<wheel-up> <double-wheel-up> <wheel-= up> <double-wheel-up>=20
<wheel-up> <double-wheel-up> <wheel-up> <wheel-up&= gt;
<double-wheel-up> <triple-wheel-up> <down-mouse-1>= ;
<mouse-1> C-x C-k C-h C-v C-c C-v <return> <escape>= =20
x e <up> <return>

Recent messages:
Loading c:/Doc= uments and Settings/Elrond/UnixHome/.recentf...done
Cleaning up the rece= ntf list...done (0 removed)
For information about GNU Emacs and the GNU = system, type C-h C-a.
Fontifying *Python*... (regexps...........)
For information about GN= U Emacs and the GNU system, type C-h C-a.
Wrote c:/Documents and Setting= s/Elrond/Desktop/test.py
Type C-x 1 to remove help window. 
byt= e-code: Beginning of buffer [2 times]
(No files need saving)
goto-history-element: Beginning of history; n= o preceding item

------=_Part_46147_10627233.1194517831938-- ------=_Part_46146_6303397.1194517831937 Content-Type: text/plain; name=emacs_pychecker_bug.py Content-Transfer-Encoding: base64 X-Attachment-Id: f_f8r51p0f0 Content-Disposition: attachment; filename=emacs_pychecker_bug.py DQojIFRoaXMgaXMganVzdCBoZXJlIHRvIGNoZWNrIHRoYXQgY2xpY2tpbmcgb24gYSB3YXJuaW5n DQojIGluIHRoZSBjb21waWxhdGlvbiB3aW5kb3cgc3RpbGwgdGFrZXMgdXMgdG8gdGhlIGNvcnJl Y3QNCiMgbGluZSBudW1iZXINCmlmIEZhbHNlOg0KICAgIG5vbkV4aXN0YW50KCJJIHNob3VsZCBy YWlzZSBhIHdhcm5pbmciKQ0KDQpyYXdfaW5wdXQoIlxuIiBcDQogICAgICAgICAgICAgICJUaGlz IHdpbGwgaGFuZyBweWNoZWNrZXIgaW4gZW1hY3MuLi5cbiIgXA0KICAgICAgICAgICAgICAiUHJl c3MgZW50ZXIgdG8gZXhpdC4uLiIpDQoNCg== ------=_Part_46146_6303397.1194517831937 Content-Type: text/plain; charset="us-ascii" MIME-Version: 1.0 Content-Transfer-Encoding: 7bit Content-Disposition: inline _______________________________________________ Emacs-devel mailing list Emacs-devel@gnu.org http://lists.gnu.org/mailman/listinfo/emacs-devel ------=_Part_46146_6303397.1194517831937--