running IDLE from another program?
Kent Johnson
kent at kentsjohnson.com
Sat Apr 1 06:34:45 EST 2006
John Salerno wrote:
> Kent Johnson wrote:
>
>>John Salerno wrote:
>>
>>>Kent Johnson wrote:
>>>
>>>>You probably don't need to do that. Just run the file in python
>>>>directly. I don't know UE, but when you configure an external tool, tell
>>>>it to run python.exe and pass the current file as a command line parameter.
>>>>
>>>
>>>I've tried a lot of combinations for the command line to execute, but
>>>nothing is working. What format should it be in? Should it look like this:
>>>
>>>C:\Python24\python.exe module ?
>>
>>C:\Python24\python.exe D:\full\path\to\myprogram.py
>>
>>There is a post on the UltraEdit forum from JohnJSal, is that not you?
>>Whoever it is got this working...
>>http://www.ultraedit.com/index.php?name=Forums&file=viewtopic&t=2732&highlight=python
>>
>>Kent
>
>
> Yes, that's me. :) But all that that post accomplished was getting me to
> run the file itself, as if I had double-clicked on it. This isn't what I
> want. I want it to run in a 'debug' type of environment like IDLE so I
> can see any error messages.
I'm not sure what you mean by a 'debug' type environment. If you mean,
you want to run the program in a debugger and step through it, then this
approach won't work. If you just mean that you want to see the output of
the program, it will work.
>
> I tried your suggestion and seems to half-way work. But it doesn't open
> the program in a different environment (such as IDLE), it just opens the
> output in a new text window in UE. Here's the output:
>
> ['qIQNlQSLi', 'eOEKiVEYj', 'aZADnMCZq', 'bZUTkLYNg', 'uCNDeHSBj',
> 'kOIXdKBFh', 'dXJVlGZVm', 'gZAGiLQZx', 'vCJAsACFl', 'qKWGtIDCj']
> Traceback (most recent call last):
> File "C:\Python24\myscripts\challenge\small_letter.py", line 15, in ?
> raw_input()
> EOFError: EOF when reading a line
OK, your program is reading from standard input and the environment set
up by UltraEdit doesn't support this. If you are trying to run
interactive programs this approach won't work.
>
>
> The list is the output from the script. I don't know why the end of file
> error is raised though, because it wouldn't have been raised if I ran
> the file in IDLE. So something still isn't quite right.
Because IDLE does support input.
I may have put too much interpretation on your original question because
I have my editor (TextPad) configured to run the front window in Python
and I find it a very productive way to work. But it's not IDLE and it
doesn't allow interactive input. I rarely write a program that requires
keyboard input so that's not a problem for me.
One thing that is really useful about running in an editor window is
that (in TextPad, anyway) I can double-click on an error message and go
directly to the line with the error.
Anyway, it turns out IDLE has a command-line switch that lets you pass a
file to run. Try
C:\Python24\Lib\idlelib\idle -r C:\path\to\myprog.py
Kent
More information about the Python-list
mailing list