[Python-bugs-list] [ python-Bugs-545436 ] py-execute-string doesn't work

noreply@sourceforge.net noreply@sourceforge.net
Mon, 22 Apr 2002 08:24:06 -0700


Bugs item #545436, was opened at 2002-04-17 20:25
You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=545436&group_id=5470

Category: Demos and Tools
Group: None
Status: Open
>Resolution: Fixed
Priority: 5
Submitted By: Skip Montanaro (montanaro)
Assigned to: Barry Warsaw (bwarsaw)
Summary: py-execute-string doesn't work

Initial Comment:
The python-mode function py-execute-string appears 
not to work.  In XEmacs 21.4.6 I executed

    M-x py-execute-string
    print "hello world"

and got a "No output." message.

Stepping through the code using edebug it appears 
that in py-execute-region the local variable cmd
(right after the "horrible hack" comment) is set to
the empty string.  I think it's because that chunk
of code uses buffer-local info to determine what
command to run.  Executing py-execute-region from
a fundamental-mode buffer also fails.  Executing
python-mode and then running it again succeeds.

Adding

	(if (equal cmd "")
	    (setq cmd "python"))

right after cmd is set seems to make things work
regardless of the buffer's mode.



----------------------------------------------------------------------

>Comment By: Barry Warsaw (bwarsaw)
Date: 2002-04-22 11:24

Message:
Logged In: YES 
user_id=12800

Skip, tell me what you think of the attached patch.  It sets
a local `shell' variable to the value of py-which-shell
after setting the temporary file to python-mode.

----------------------------------------------------------------------

You can respond by visiting: 
http://sourceforge.net/tracker/?func=detail&atid=105470&aid=545436&group_id=5470