Python - Calling a script from another script and handling exceptions from the second one -
so have script, python script (call aaa.py) , calls method in python script (call bbb.py). method in bbb.py throws , handles keyerror exception when run aaa.py raises exception console if wasn't handled... , don't understand why. explain me please?
yes i've read documentation on exceptions in python.
here try/except:
try: if network['network'] == vlans_dict[network['netname']]['netaddr']: self.test_pass('network address matches vlan router: ' + str(network['network'])) else: self.test_fail('network address not match vlan router: ' + network['netname'], 'expected: ' + str(vlans_dict[network['netname']]['netaddr']), 'actual: ' + str(network['network'])) except keyerror: self.test_fail("no subnet obtained " + network['netname'] + " vlan info")
honestly ridiculous add rest of code...
so add bit more this... if run second script directly on it's own handles exception gracefully intended.
regards, j
right.... short answer: i'm absolute grade f**kin idiot...
longer answer: modifying copy of bbb.py not bbb.py aaa.py getting class path... code fine, wasn't running it!
Comments
Post a Comment