Sorry guys, how do you print a message dialog box if a file doesn't exists in python? I am currently using a program to do segmentation of video file and assembling it the files that I need and excluding those I don't. I have completed the tasks but if I randomly type a file that doesn't exists, it will print an error but what I want is a message Dialog box to appear, is there any way to do this?

3 Years
Discussion Span
Last Post by bumsfeld

you need to put the ode that opens the file in try-except braces.
Then open a wxMessagebox inside the catch(exeption) brace. Its been along time i worked with wx but the style and logic is the same on GUI's.

    open file()

Vegaseat be nice will you.?
yea i faultered. Its PYTHON. thanks for your tip ))

Edited by richieking


Let's not forget that WxPython is just the wrapper for WxWindows which is written in C++.
The wrapper seems to ignore the C++ error handling. It could have been done, but wasn't.
I don't think there is any GUI toolkit that is written in pure Python, bummer.

On the other hand Python is very good glue language for other languages. It's easy to make wrappers.

Edited by bumsfeld: wrapper

This question has already been answered. Start a new discussion instead.
Have something to contribute to this discussion? Please be thoughtful, detailed and courteous, and be sure to adhere to our posting rules.