Windows/DOS: double clicking a .py file
whisper at oz.net
Tue Sep 10 01:17:08 CEST 2002
cmd.exe will accept a flag telling it to stay open after something is run.
You can create a shortcut along the lines of:
cmd /K python myscript.py <args>
You could also add this to the cmd shortcut itself if you have one, but that
generally turns out to be a major pain since all dos-window based apps will
then leave their windows open.
A nice aspect of using a custom cmd shortcut is that you can set colors and
fonts and window size just for this app which might help distinguish it if
you have a lot of dos windows open. You can set the screen buffer height to
a high number so you can scroll really far back (not a good idea to make the
screen buffer width greater then the window width though).
you can type 'help cmd' in a dos window for more info on cmd switches.
Seattle, WA USA
> -----Original Message-----
> From: python-list-admin at python.org
> [mailto:python-list-admin at python.org]On Behalf Of Just
> Sent: Monday, September 09, 2002 15:47
> To: python-list at python.org
> Subject: Re: Windows/DOS: double clicking a .py file
> > > impossible to actually see the exception... Is there a way
> > > to keep the dos prompt window in this case?
> [Bjorn Pettersen]
> > Try something like the following... We've had much success with
> > automatically emailing the traceback back to the developer using the
> > cgitb module -- you can never trust users to give you good error reports
> > <wink> besides the cgitb module provides much more context than the
> > standard exceptions... Let me know if you'd like the code...
> > try:
> > your code here
> > except:
> > import msvcrt, traceback
> > traceback.print exc()
> > print 'Hit a key to exit'
> > while not msvcrt.kbhit():
> > pass
> Ah, that looks like a good trick, I will try that.
> Thanks for your code offer, but in most cases I will have to ask for the
> input data anyway, so a simple traceback is good enough for now.
More information about the Python-list