Python Forum
exception not caught in my filetopystr.py
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
exception not caught in my filetopystr.py
#3
i added that ... but IOError still fails to be caught and triggers the incomplete traceback.  could it be that i cannot do this through a function call?  it's like my except statements have no effect.

Output:
lt1/forums /home/forums 89> tail -24 filetopystr.py if __name__ == '__main__':     try:         result = main( argv )     except KeyboardInterrupt:         result = 140         print( '' )     except IOError:         print( 'it worked this time', file=stderr )         result = 141     except:         print( 'wtf:', exc_info()[0], file=stderr )         result = 141     stdout.flush()     try:         exit( int( result ) )     except ValueError:         print( str( result ), file=stderr )         exit( 1 )     except TypeError:         if result == None:             exit( 0 )         exit( 255 ) # EOF lt1/forums /home/forums 90> python filetopystr.py 0 'http://www.google.com/' ip 80|head -80|tail -3 connecting to 'http://www.google.com/' connected  to 'http://www.google.com/' reading  from 'http://www.google.com/' read 10871 bytes 'google.com/mail/?tab=wm">Gmail</a> <a class=gb1 href="https://drive.google.co'\ 'm/?tab=wo">Drive</a> <a class=gb1 style="text-decoration:none" href="https://'\ 'www.google.com/intl/en/options/"><u>More</u> &raquo;</a></nobr></div><div id='\ Traceback (most recent call last):   File "filetopystr.py", line 162, in <module>     stdout.flush() IOError: [Errno 32] Broken pipe lt1/forums /home/forums 91>
Tradition is peer pressure from dead people

What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.
Reply


Messages In This Thread
RE: exception not caught in my filetopystr.py - by Skaperen - Dec-29-2016, 08:11 AM

Possibly Related Threads…
Thread Author Replies Views Last Post
  During handling of the above exception, another exception occurred Skaperen 7 27,169 Dec-21-2018, 10:58 AM
Last Post: Gribouillis

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020