[pythonvis] Re: Running scripts from EdSharp

  • From: "Richard Dinger" <rrdinger@xxxxxxxxxx>
  • To: <pythonvis@xxxxxxxxxxxxx>
  • Date: Mon, 26 May 2014 19:17:35 -0700

Hi Jim,

I hate to be so dense, but I do not understand what exactly you are proposing.

So say I have the following situation. I have the following two line script in EdSharp:

print 'hello world'
raw_input('hit enter to continue')

As you know the above script will display the message and wait for the enter key to be pressed.

Now where does your batch job come in here? Does the '@C:\python27\python.ese %1 %2 ...' go in some configuration item?

And which version of F5 is used (F5 or Alt+F5 or Dtrl+F5)?

Thanks,
Richard
-----Original Message----- From: Jim
Sent: Monday, May 26, 2014 12:53 PM
To: pythonvis@xxxxxxxxxxxxx
Subject: [pythonvis] Re: Running scripts from EdSharp

Hi Richard,
It occurred to me just now, that it might be a good experiment to try
to run a bach file from EdSharp that looks like the below code, and
use the configuration dialog to run the batch file instead of Python
directly.

@c:\python27\python %1 %2 %3 %4 %5 %6 %7 %8 %9

Those percent things are place holders. The batch file should pick up
the parameters from EdSharp, or at least I hope it will. If not, just
get rid of everything but the path to the batch file in your EdSharp
command. I think this will also allow you to get rid of the raw_input
problem.

Thanks.

Jim

On 5/26/14, Richard Dinger <rrdinger@xxxxxxxxxx> wrote:
Preliminary: How to run Python scripts from inside EdSharp

I have been snooping around in EdSharp trying to determine how to use the
various forms of the f5 command to execute the script from within the
editor.  This document describes what I have found so far.  If anyone has
additional information, please share it by responding to this message.

Warning while experimenting, I occasionally caused my machine to lock up and
ctrl+alt+delete took a long time to regain control of the machine -- so be
careful.

First, get your EdSharp editor set up for Python.  Select Python via the
shift+ctrl+f5 command and select any options you want from the configuration
command shift+alt+c or leave the default values for now if you don't know
what the option means.  See more on options in the following.

As I currently understand it, there are three forms of the editor's f5
command that execute your script. The first is just f5 or the run command, which simply runs your source file via the Windows run command. That is the
same as hitting enter on the file name in Windows Explorer.

When using f5 including a raw_input('enter to continue') call at the end of
your script will hold output on screen until you type enter.      You can
then examine the output via the jaws cursor. If there is an error, however,
you may not hear anything and nothing is on screen just like Windows
Explorer.

The second form of the editor's f5 command is alt+f5 or the prompt command. This appears to run the command line in the prompt tag in your configuration
(shift+alt+c).  For python installed at c:\python27 I set this to:
c:\python27\python.exe %Source% 2>&1

The %Source% is an environment variable with the current editor file path.
When you run alt+f5 a dialog with this prompt comes up so you can add
command line arguments or make some other change before running it.  The
output goes to attempt file accessible via shift+alt+f5.  The temp can be
dismissed via ctrl+f4.

Warning: Do not leave off the 2>&1 output redirection or your machine may
lock up! I don't know if you can direct to another file of your choice as I
have not tried that out.

The last form of the f5 command is ctrl+f5 or the compile command..  This
also requires some set up in the configuration file (shift+alt+c).  I am
using the same text as the prompt above, but for the compile tag in the
configuration:
c:\python27\python.exe %Source% 2>&1

The differences I know of between prompt and compile are:
- prompt gives you a chance to change the command
- compile speaks the output and the errors
- compile positions the editor at the error

Both save output to a temp file, type shift+alt+f5 to bring up the temp file
containing output and errors.  Type ctrl+f4 to dismiss the temp file
window.

A problem with alt+f5 and ctrl+f5 is using the raw_input function yields an
EOF error instead of waiting for you to hit enter.  Jamal, the author of
EdSharp is looking into this problem.  And I find shift+alt+f5 a little
clumsy to bring up the temp file.

While EdSharp may not eliminate the need for a command shell running, the
editor does provide some options.

Richard


--
e+r=o
Skype: jim.homme
List web page is
//www.freelists.org/webpage/pythonvis

To unsubscribe, send email to
pythonvis-request@xxxxxxxxxxxxx with "unsubscribe" in the Subject field. List web page is //www.freelists.org/webpage/pythonvis

To unsubscribe, send email to pythonvis-request@xxxxxxxxxxxxx with "unsubscribe" in the Subject field.

Other related posts: