Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

ROSBagException should call the base constructor #1209

Closed
lukehansen opened this issue Oct 30, 2017 · 2 comments · Fixed by #1652
Closed

ROSBagException should call the base constructor #1209

lukehansen opened this issue Oct 30, 2017 · 2 comments · Fixed by #1652

Comments

@lukehansen
Copy link

In python 2.7 there is a subtle bug with unpickling custom exceptions; this was fixed in 3.3, see https://bugs.python.org/issue1692335. As a workaround for 2.7 we can re-define these exceptions as below.

class ROSBagException(Exception):
    """
    Base class for exceptions in rosbag.
    """
    pass
 
class ROSBagFormatException(ROSBagException):
    """
    Exceptions for errors relating to the bag file format.
    """
    pass

class ROSBagUnindexedException(ROSBagException):
    """
    Exception for unindexed bags.
    """
    def __init__(self, *args):
        ROSBagException.__init__(self, 'Unindexed bag')

For context, I came across this issue when a ROSBagUnindexedException was raised in a multiprocessing.Pool.map thread. It throws the __init__ exception and hangs, as described here: https://lists.gt.net/python/bugs/1025933

@dirk-thomas
Copy link
Member

Can you please provide a pull request with the proposed patch against the current default branch (lunar-devel). Thanks.

@lukehansen
Copy link
Author

Sure, though it's not really a ros_comm bug and has been patched in python 3.3. PR is here: #1210

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants