GNOME Bugzilla – Bug 367610
Python console doesn't allow different code blocks
Last modified: 2019-03-23 20:36:26 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):
+ Trace 80413
exec command in self.namespace
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.
Created attachment 75660 [details] [review] Proposed patch
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 :-)
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