Unix-head needs to Windows-ize his Python script (II)

Ethan Furman ethan at stoneleaf.us
Fri Oct 22 12:19:00 EDT 2010


gb345 wrote:
> 
> In <mailman.128.1287758336.2218.python-list at python.org> Tim Golden <mail at timgolden.me.uk> writes:
> 
>> On 22/10/2010 15:25, gb345 wrote:
>>> 3. Both versions of the app work fine on Windows 7, as long as
>>> I do the following:
>>>    a. run CMD
>>>    b. cd to where the GUI script and my original script live
>>>    c. execute either
>>>
>>>       C:\Python27\python myapp_tk.py
>>>
>>>       or
>>>
>>>       C:\Python27\python myapp_wx.py
> 
>> The standard python.org associates .py & .pyw files with
>> the installed interpreter. If you double-click on either
>> of those files it should just run. If you were to rename
>> the .py to a .pyw it would run without a console window
>> showing up.
> 
> Thanks for the tip!  That would be great if I could get it to work.
> 
> When I click on the (renamed) myapp_tk.pyw or myapp_wx.pyw a console
> appears and immediately disappears (it just flashes, really), too
> quickly for me to see what it says.  (I imagine it's some error
> message.) The renamed files still work fine if I run them as shown
> above, though.

You need to create a shortcut on the Windows 7 desktop (not sure of the 
particulars for 7, but it starts with a right-click).  Either while 
creating the shortcut, or afterwards (with another right-click on the 
shortcut icon, and selecting Properties [hopefully that was not 
renamed]) have the startup directory be where ever your script lives, 
and the command line should read C:\Python27\pythonw myapp_tk.py.

*disclaimer: I haven't used Windows 7 yet, so some details may vary.

~Ethan~



More information about the Python-list mailing list