Author Topic: Enhance the Python build window interface.  (Read 1709 times)

chriss

  • Junior Community Member
  • Posts: 6
  • Hero Points: 1
Enhance the Python build window interface.
« on: May 27, 2012, 06:14:51 AM »
Enhance the Python build window interface.

If you apply the Python command line option -i (Python options interpreter arguments) and direct the output to the build window, the script will execute correctly, display output in the correct sequence and prompt appropriately for input (raw_input). After the script terminates, the Python interpreter is left in input mode in the build window and this allows the final state of the program to be evaluated etc.

If the Execute command is repeated immediately, Python reports errors as you would expect (setenv for example). The Python interpreter in the build window is terminated in the usual way - quit() - and any subsequent Execute now works.

If Execute specifies an X terminal, the script executes normally and is also left in Python interpreter input mode at the end. It must be manually closed (quit()). If the Execute is repeated while the first X terminal is active, an independent X terminal is forked.

I would like to have an additional build option or macro that would allow me to highlight a block of code in the edit window and pass that directly to the Python interpreter active in the build window. Rerun the __main__ function say. Or rerun the entire script. This capability would provide similar functionality to Slime in Lisp or IDLE in Python. One minor issue is focus is left in the edit window and not the build window. All of this, of course, does not apply if an external X terminal was specified.

A few remarks. Specifying the command line option -i sets both Execute and Debug. Debug seems to work - I haven't tested in detail - but this option may not be appropriate.

On a separate tack, the X terminal option seems like an anomaly from the X version of OS X Slickedit. I would much prefer to use iTerm2 or if that is not possible the standard terminal. I did some testing and both iTerm2 and Terminal windows were opened, but the Python script was orphaned (ps -ef | grep python) and no output was generated.

I tested this capability on the beta-6 (version 17.0.0.5) of Slickedit for OS/X (Lion 10.7.4).
 
Cheers,  Chris Sundstrom  Sydney Australia 






   

chriss

  • Junior Community Member
  • Posts: 6
  • Hero Points: 1
Re: Enhance the Python build window interface.
« Reply #1 on: May 27, 2012, 11:45:05 AM »
Python Build Window.

I've been a bit simple minded with the improvement suggested above  :-[. I am really looking to mimic the behaviour of IDLE, presumably with a small number of SlickC macros. I would like to be able to pass single statements from the editing window to the interactive Python interpreter. Usually to correct function definitions and allow for retesting. Or to stop or restart the interpreter.

Note, I am not sure if the -i option is a risk for the debugging session and needs to be removed before the debugger is started.

It is tempting to try to configure SlickEdit like a full blown emacs co-operative environment. 

The request for iTerm2 or Terminal support in lieu of an X term has been made before I believe.

Cheers,  Chris S