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?
pythonforlife 0 Newbie Poster
Recommended Answers
Jump to Post# error redirection=0 to console # error redirection=1 to dialog window app = wx.App(1)
Jump to Postyou 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.try{ open file() } except(msg){ wxMessageBox(values,message,...) }
All 5 Replies
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
richieking 44 Master Poster
vegaseat 1,735 DaniWeb's Hypocrite Team Colleague
richieking 44 Master Poster
bumsfeld 413 Nearly a Posting Virtuoso
Be a part of the DaniWeb community
We're a friendly, industry-focused community of developers, IT pros, digital marketers, and technology enthusiasts meeting, networking, learning, and sharing knowledge.