After an evaluation, GNOME has moved from Bugzilla to GitLab. Learn more about GitLab.
No new issues can be reported in GNOME Bugzilla anymore.
To report an issue in a GNOME project, go to GNOME GitLab.
Do not go to GNOME Gitlab for: Bluefish, Doxygen, GnuCash, GStreamer, java-gnome, LDTP, NetworkManager, Tomboy.
Bug 367610 - Python console doesn't allow different code blocks
Python console doesn't allow different code blocks
Status: RESOLVED FIXED
Product: gedit-plugins
Classification: Other
Component: General
2.16.x
Other All
: Normal minor
: ---
Assigned To: Gedit maintainers
Gedit maintainers
Depends on:
Blocks:
 
 
Reported: 2006-10-30 13:24 UTC by Brian McKenna
Modified: 2019-03-23 20:36 UTC
See Also:
GNOME target: ---
GNOME version: 2.15/2.16


Attachments
Proposed patch (1.55 KB, patch)
2006-10-30 13:25 UTC, Brian McKenna
accepted-commit_now Details | Review

Description Brian McKenna 2006-10-30 13:24:25 UTC
Please describe the problem:
Gedit's default Python console plugin prevents the user from inputting a
code block such as if, else, try, def, etc. This is because the plugin passes
each line to Python and not each block.

Steps to reproduce:
1. Load the plugin and open the console window.
2. Type in "if True:"
3. Press enter.

Actual results:
The plugin passes the line as a command. This results in an error;

Traceback (most recent call last):
  • File "/usr/lib/rhythmbox/plugins/python-console/pythonconsole.py", line 340 in __run
    exec command in self.namespace
  • File "<string>", line 1
    if True:

Expected results:
The plugin should ask for the next line of the code block until the user enters
a blank line. Like so:

>>> if True:
...   print "Done"
... 
Done

Does this happen every time?
Yes

Other information:
I first found this bug in Rhythmbox:
http://bugzilla.gnome.org/show_bug.cgi?id=366696
I was recommended to file a report here as well, due to Rhythmbox recycling the code from Gedit.
Comment 1 Brian McKenna 2006-10-30 13:25:14 UTC
Created attachment 75660 [details] [review]
Proposed patch
Comment 2 Steve Frécinaux 2006-10-30 16:21:07 UTC
Actually you could hit ctrl+enter to continue your command on the next line. I agree it wasn't easily discoverable but it was meant to be fixed in order to follow the behaviour of the stock python console... What you just did.

The patch looks good to me, please commit :-)
Comment 3 Paolo Maggi 2006-11-05 15:29:27 UTC
Patch committed to CVS HEAD

2006-11-05  Paolo Maggi  <paolo@gnome.org>

	Fixes bug #367610 – Python console doesn't allow different code blocks
	
	Patch by Brian McKenna  <puffnfresh@gmail.com>

	* plugins/pythonconsole/pythonconsole/console.py: allow the python 
	console to handle blocks