Installation Successful, but pythonw and idle doesn't function

Thomas 'PointedEars' Lahn PointedEars at web.de
Thu Aug 6 08:56:11 CEST 2015


Terry Reedy wrote:

> On 8/5/2015 6:09 PM, Thomas 'PointedEars' Lahn wrote:
>> Rick Smith wrote:
>>> I also attempted to run "idle", with the following results:
>>>
>>>     C:
>> \Users\judy\AppData\Local\Programs\Python\Python35-32\Lib\idlelib>idle.py
>>>     ** IDLE can't import Tkinter.
>>>     Your Python may not be configured for Tk. **
> 
> Rick, can you run python?  What happens with 'import tkinter'?
> 
>> I do not know IDLE well (if at all after all this time).  Make sure that
>> you have installed the prerequisites.
> 
> A Windows install should install tkinter and Idle together.
> 
>> But it strikes me as odd to run a GUI-based application from the Windows
>> command shell.
> 
> This is the right thing to do when there is a problem, as some error
> messages get delivered to the console.  The prime example is the above.
>   If Idle cannot import tkinter, it cannot use a tkinter message box.

Clarification: It is _not_ the right thing to do to run a GUI-based 
application obviously *written in Python*, like IDLE, *this way*.  Because, 
AISB, usually there is a script that sets up the environment (e.g. the 
PYTHONPATH), and the working directory may matter.

So one should always look for the application shortcut (icon) first, and, if 
found, use its properties to run the application.  In 32-bit Windows, the 
easiest way is to type Windows+R (or, in the Start Menu go to the search 
field, or select the “Run…” command), and type

  cmd /k "cd $WORKDIR & $COMMAND"

which changes to the working directory of the shortcut (replace $WORKDIR 
with what you find there), and if successful executes $COMMAND there (dito), 
while keeping the “Command Prompt” window open because the command shell 
does not exit (it would if you used “/c” instead of “/k”).

>  > Is there not an icon that you can use instead to run it?
> 
> In the start menu, but that error message would not appear.

Yes, the “Run command in shell” checkbox appears to be restricted to 
application icons on real operating systems :->

But you can modify the command of the shortcut to say “cmd /k 
"$ORIGINAL_COMMAND"” to work around this.

-- 
PointedEars

Twitter: @PointedEars2
Please do not cc me. / Bitte keine Kopien per E-Mail.


More information about the Python-list mailing list