import sys import os from ldtputils import* full_path = os.environ['HOME'] + '/firefox' if os.path.isdir(full_path): print "Directory exists" full_path = full_path + '/firefox' if os.path.isfile(full_path): print "File exists" full_path = full_path + ' -P spooky' print full_path launchapp(full_path,1) else: print "Oops! no file" sys.exit(0) else: print "Directory doesn't exist" sys.exit(0) Getting this error Casanova: ashish@ash:~/minefield$ python launch_file_menu.py Directory doesn't exist Unhandled exception in thread started by Error in sys.excepthook: Original exception was: