Jun-26-2020, 11:02 PM
i have mishandling of a case of 2 exceptions at the same time. if each happens one at a time, they are handled OK. but if a second exception happens, i get the trace backs. i want to just gave them both handled.
here is the output i dob't want to get:
here is the output i dob't want to get:
Output:^C
Traceback (most recent call last):
File "amijsonxz_json_ubuntu_lts_ids.py", line 203, in <module>
result=main(cmdpath,args)
File "amijsonxz_json_ubuntu_lts_ids.py", line 107, in main
amis = json.load(f)
File "/usr/lib/python3.6/json/__init__.py", line 299, in load
parse_constant=parse_constant, object_pairs_hook=object_pairs_hook, **kw)
File "/usr/lib/python3.6/json/__init__.py", line 354, in loads
return _default_decoder.decode(s)
File "/usr/lib/python3.6/json/decoder.py", line 339, in decode
obj, end = self.raw_decode(s, idx=_w(s, 0).end())
File "/usr/lib/python3.6/json/decoder.py", line 355, in raw_decode
obj, end = self.scan_once(s, idx)
KeyboardInterrupt
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "amijsonxz_json_ubuntu_lts_ids.py", line 207, in <module>
print(flush=True)
BrokenPipeError: [Errno 32] Broken pipe
here is the end of the code where it happens:if __name__ == '__main__': from sys import argv,stderr,stdin,stdout,version_info cmdpath = argv.pop(0) if argv and argv[0][:2]=='--': if '--help' in argv: help() if '--version' in argv: version() try: result=main(cmdpath,argv) except BrokenPipeError: exit(141) except KeyboardInterrupt: print(flush=True) exit(98) if result is None or result is True: exit(0) elif result is False: exit(1) exit(int(float(result)))i can provide the entire code if you need it (213 lines. 6153 bytes)