[Tutor] interpreter restarts

Sara Johnson sarliz73 at yahoo.com
Tue Jul 17 03:50:04 CEST 2007


Luke, Jacob, et. al...

Dumb question (may be slightly off course from what you two were discussing), but are you both describing how to get the IDLE to run along with the editor?  I may just be getting too many things confused.  I've tried to run IDLE, but that's not working.  I have the same function through opening it separately from the Start menu but then it doesn't work as IDLE should work with the editor (or so I've been told that happens).  I can type the word Python in my editor and it comes up, but then the editor is gone.  I've gone so long with just SSH, but at this point it's worth it if I find a way that makes sense.  As someone mentioned from this list, at least it'll be code that is easier to read for a newbie like myself.  

(Hope that didn't confuse or cause unnecessary headaches...)

Sara


----- Original Message ----
From: Luke Paireepinart <rabidpoobear at gmail.com>
To: Tiger12506 <keridee at jayco.net>
Cc: tutor at python.org
Sent: Monday, July 16, 2007 7:00:53 PM
Subject: Re: [Tutor] interpreter restarts


Tiger12506 wrote:
>> But there's an exception to that - if you right-click a file in Windoze
>> and 'edit' it,
>> IDLE won't open up its subprocess, and as such, it can't restart the
>> interpreter session because it's running in the same
>> process as IDLE, and to restart the interpreter would mean restarting 
>> IDLE.
>> Boy, that 'edit with idle' thing sure does cause some problems, don't it? 
>> :)
>> -Luke
>>     
>
> Thanks, Luke. I hadn't thought of that. Question: Why won't IDLE open up its 
> subprocess?
>
> This is the command that is in the registry concerning the Edit with IDLE 
> menu.
> "C:\Python25\pythonw.exe" "C:\Python25\Lib\idlelib\idle.pyw" -n -e "%1"
>
> This is the Target for the shortcut in the Start Menu (Note: the Target box 
> was disabled!)
> Python 2.5.1
>
> I thought that this was incredibly strange, so I opened this shortcut in a 
> hex editor to see what was different about this shortcut. (Normally, they 
> have a path in the target box)
>
> What I found surprised me. The title of the file in the hex editor said 
> "python_icon.exe"
> I started laughing maniacally and checked the full path of the file from 
> within the hex editor.
> C:\windows\installer\{31800004-6386-4999-a519-518f2d78d8f0}\python_icon.exe
>
> IDLE is started in two *very* different ways. So my next question was: Can 
> you pass arguments to this python_icon.exe? Simple navigations to that 
> directory and a confirmation... Yuck. You can't even execute it from 
> explorer. A low-level ZwTerminateProcess function from ntdll is called ... 
> Let me try something...
>
> Woah... {31800004-6386-4999-a519-518f2d78d8f0} appears in the registry in 
> alot of places. The Uninstall key for Add/Remove Programs, some weird data 
> thing... Okay, this is beyond me. I don't know the registry or understand 
> CLSIDs very well. Someone who knows Windows inside and out has done a number 
> with the python installer, or at least the msi installer does this all 
> automatically. Interesting. I wonder just how python_icon.exe starts IDLE. 
> If I could figure that out, I could emulate it with the Edit w/Idle menu 
> item and get IDLE to start a subprocess! But how.... any ideas?
>   
It sounds like python_icon.exe is a fake executable that just contains 
the icon for python programs...
hence the name.
You probably stumbled across the path to the icon to use, instead of the 
path that is used when running the 'Edit with IDLE' thing.
Try this:
open an Explorer window, via Start Button -> Run -> explorer {ENTER}
or your favorite method.  Use the My Computer shortcut if you want, 
either way.
Now hit "Alt, t, o" to browse to the Tools -> Folder Options menu setting.
Go to the File Types tab, and scroll down till you find "PY"
click the Advanced button.
You should now see a dialog box with Edit with IDLE listed under actions.
Click Edit when "Edit with IDLE" is selected.
in the "Application used to perform action:" field you should see 
something like this:

"C:\Python24\pythonw.exe" "C:\Python24\Lib\idlelib\idle.pyw" -n -e "%1"

Basically, this is the same as saying:
python idle.py
except it's more verbose because python may not be on your path (and 
pythonw is used instead of python so there's no dos box)
As you will notice, there are some parameters there at the end.
the -n is the one you're interested in .
-n means no subprocess.
Just remove that, and you will have a subprocess on the 'Edit with IDLE' 
feature.
There is some caveat here - it doesn't work correctly on some systems, 
I'm told.
I've never had problems changing this, but I don't recommend it to 
people randomly just in case it were to cause problems for them.
Then I'd feel bad.
But since you asked, I thought I'd give you all the info you need.
HTH,
-Luke
P.S. nice detective skillz ;)
_______________________________________________
Tutor maillist  -  Tutor at python.org
http://mail.python.org/mailman/listinfo/tutor


       
____________________________________________________________________________________
Be a better Globetrotter. Get better travel answers from someone who knows. Yahoo! Answers - Check it out.
http://answers.yahoo.com/dir/?link=list&sid=396545469
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20070716/1bb1b994/attachment-0001.htm 


More information about the Tutor mailing list