Dec-29-2016, 08:11 AM
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> »</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.
What do you call someone who speaks three languages? Trilingual. Two languages? Bilingual. One language? American.