On 08/26/2013 07:49 PM, Skip Montanaro wrote:
Do this:
raise LockFailed("Failed to create %s" % self.path) from None
Thanks. Is there some construct which will work in 2.x and 3.x?
Something like this (untested):
exc = None
try:
write_pid_to_lockfile(somefile)
except OSError as exc:
exc = sys.exc_info()[0] # not sure of index
if exc:
if conditions_i_can_handle:
do_other_stuff...
else:
raise LockFailed("Failed to create %s" % self.path)
Since you're raising outside the try...except block you won't see the chained
exception in Python3.
--
~Ethan~
--
http://mail.python.org/mailman/listinfo/python-list