Author Topic: Slickedit Pro 2016 v21.xxx - Run a python script?  (Read 1774 times)

ewjax

  • Community Member
  • Posts: 13
  • Hero Points: 0
Slickedit Pro 2016 v21.xxx - Run a python script?
« on: June 26, 2021, 06:41:59 PM »
I've been using SlickEdit forever (over 20 years), have been a long time advocate.

However, my professional life evolved away from coding many years ago, and so even though I still use it out of nostalgia, I really have only been using it as a simple text editor.

I suspect my question is a super simple one:  I'm playing with python (Windows), and have been just keeping a command line terminal window open to run the python scripts to test them.  I *know* SlickEdit should be able to do that from its integrated environment, but I spent 10 minutes trying to figure it out, and really got hung up.  It's running the wrong shell (windows cmd instead of tcc), it isn't capturing stdout and stderr, and I can't seen to stop the python script with a Ctrl-C when I need to interrupt it.

I feel silly asking for advice, I should be able to figure this out, but....help?

Thanks

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Slickedit Pro 2016 v21.xxx - Run a python script?
« Reply #1 on: June 28, 2021, 03:52:31 PM »
You should be able to change the shell used by the build window and project tools. Go to Macro>Set Macro Variable, you can set "def_ntshell" variable to the path to the tcc executable, plus any command line options you'll need to pass to it.  And restart SlickEdit after changing it, as a quick way to terminate any running cmd.exe shell, and go with the updated option.

For v21, with the python script already opened in the editor, you should be able to go to Project -> Properties..., go to the Tools tab, select the Execute tool, and check "Capture output" and "Output goes to build window".   I think Ctrl-C should work fine too once that is done.

That will change the setting for that python script.  You can also change the default settings for all python scripts you open. Go to Tools -> Options, then go to Languages > Scripting Languages > Python > Single File Projects, and hit the "Edit" button.  You can make the same changes from the last paragraph, and that will be come the default when you open python files. 

Looking at it, I think those Python stdout/stderr capturing flag defaults were changed to be on in a later release, that's in inconvenient default.

ewjax

  • Community Member
  • Posts: 13
  • Hero Points: 0
Re: Slickedit Pro 2016 v21.xxx - Run a python script?
« Reply #2 on: June 28, 2021, 06:35:25 PM »
Thanks for the reply.
1.  Setting the variable did fix the shell being used, thanks.

2.  All the settings were already selected for capturing output to build buffer, etc.  It still isn't capturing stdout/stderr to the build window, nor is it responding to Ctrl-C.

Part of the problem may be that the python script I'm messing with atm is running an infinite "while True" loop, right now only way to stop the process is with Ctrl-C.  That is perhaps atypical from a "run to completion" simple script.

3.  New question - looking at the main slickedit web page, it shows what appears to be a "mini map" window on the far right side of the main editing window.  How do I turn that on?

patrick

  • SlickEdit Team Member
  • Senior Community Member
  • *
  • Posts: 1818
  • Hero Points: 151
Re: Slickedit Pro 2016 v21.xxx - Run a python script?
« Reply #3 on: June 28, 2021, 08:12:50 PM »
There is some buffering for the Build window, so if the script just printing a little bit and then going into a loop, it might not be flushed.  Is the script just doing some work in a loop, or is it supposed to be prompting you and waiting for input?

Hard to say for the Ctrl-C.  There were some bugs with Ctrl-C on windows that were fixed in 24.0.1, but I thought they wouldn't have applied in this case, since you couldn't get it to work with the default shell.

Can you right click in the Build window and click on "Stop process">  (or maybe "Stop build" in that version).  If that doesn't work, copy and paste the contents of your build window into this post, maybe I can see something in the commands we execute that gives me a hint.

The mini-map was added in 2018, there's no equivalent in v21.

ewjax

  • Community Member
  • Posts: 13
  • Hero Points: 0
Re: Slickedit Pro 2016 v21.xxx - Run a python script?
« Reply #4 on: June 29, 2021, 04:19:25 AM »
Thanks for the advice.

The buffering is odd.  The python script I'm messing with is effectively a fancy "tail" utility, it watches a log for new entries, prints the new entry, and reacts.  For some reason, it seems to be buffering a couple dozen lines, and not flushing the buffer.  Not sure what's up.

But it's all good.  I'm probably better off just testing the script at the command line in another window.

"Stop Build" Ctrl-O does the trick, it has the effect of a Ctrl-C to my infinite loop script.