Is there a GUI for informing a user of missing dependencies?

Dave Angel davea at ieee.org
Tue May 12 09:19:31 EDT 2009



Jason wrote:
> I'm writing a small GUI (Python 2.5/6) using wxPython and pySerial.
> Since these are both 3rd party modules, if a user doesn't have them
> installed and tries to run the GUI from a file browser, the app will
> fail silently. I'm hoping to avoid that.
>
> Sure, I'll have a readme file, but I was wondering if there is an even
> more direct way. I was going to roll my own (eg. very simple Tkinter
> fallback error dialog if wxPython import fails, wxPython error dialog
> if anything else is missing); but I was wondering if such a system
> already exists out there.
>
> — Jason
>
>   
One approach is something like:

import subprocess

errorstring = "echo XXX error occurred in my code. type 'exit' to close 
this shell window "
parms = ["cmd.exe", "/k"]
parms.append( errorstring )
subprocess.call(parms)

Any message can be built as long as it fits on one "line". And if more 
is needed, a batch file can be run instead of just "echo" at the 
beginning of the errorstring.

The user gets a command shell that he can then use to investigate 
various things, such as environment variables. And the shell goes away 
when he types the command "exit". The python program doesn't terminate 
till the user does so.

This is Windows specific, so certainly your Tkinter approach is more 
general. On the other hand, the user might have a subset of the standard 
Python installed, and Tkinter might have been deleted from his system.

If it has to work on older Python versions, you might go with 
os.system() or other similar things.




More information about the Python-list mailing list