Re: printing error message from an Exception

2010-12-10 Thread mark jason
On Dec 10, 11:55 am, Steven D'Aprano wrote: >     # By the way, IOError is not the only exception you could see. thanks for the help Steven. Is it OK to catch Exception instead of IOError ? In some operation which can cause many errors ,can I use the following? try: do_something() except Ex

printing error message from an Exception

2010-12-09 Thread mark jason
hi I was trying out some file operations and was trying to open a non existing file as below def do_work(filename): try: f = open(filename,"r"); print 'opened' except IOError, e: print 'failed',e.message finally: f.close() print 'closed' if __na

packaging python code in zip file

2010-12-09 Thread mark jason
hi, I have created a python app in eclipse pydev .The app is structured as below.. mypackage |__ __init__.py |__ driver.py |__ helper.py |__ utils.py The driver.py has the main program.I have added if __name__=="__main__" block in the driver.py and pydev's run configurat