they need to take a "msg" argument, and all other arguments must be optional:
http://stackoverflow.com/questions/16244923/how-to-make-a-custom-exception-class-with-multiple-init-args-pickleable. I've attempted fixing this in PR: https://github.com/boto/botocore/pull/835
simple testcase:
try:
raise botocore.exceptions.NoCredentialsError
except Exception as e:
b = pickle.dumps(e)
e = pickle.loads(b)
Tracking discussion of this over in the PR: #835.
this is now further compounded by the metaclass instantiation of ClientError, which return things like botocore.errorfactory.NoSuchKey, which can't pickle because that class does not exist in that module. I think a better impl is probably implementing the __reduce__ methods
@thehesiod I've opened #1191 that uses __reduce__ and which also tackles #899 to have a consistent exception error set. Bonus feature is being able to import the exception classes under botocore.exceptions.<service>.<exceptioncls>, e.g. as botocore.exceptions.s3.BucketAlreadyExists
cool, closing my PR, for future reference to others, see comments in my PR for use cases as well
I think this can now be closed, @jezdez ?
Yeah it seems to have been fixed.
Most helpful comment
@thehesiod I've opened #1191 that uses
__reduce__and which also tackles #899 to have a consistent exception error set. Bonus feature is being able to import the exception classes underbotocore.exceptions.<service>.<exceptioncls>, e.g. asbotocore.exceptions.s3.BucketAlreadyExists