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

TimeSynchronizer - Added import for python3 compatability #1633

Merged
merged 1 commit into from
Mar 14, 2019
Merged

TimeSynchronizer - Added import for python3 compatability #1633

merged 1 commit into from
Mar 14, 2019

Conversation

tykurtz
Copy link
Contributor

@tykurtz tykurtz commented Feb 27, 2019


Traceback (most recent call last):

  File "/opt/ros/kinetic/lib/python2.7/dist-packages/rospy/topics.py", line 750, in _invoke_callback
    cb(msg)

  File "/opt/ros/kinetic/lib/python2.7/dist-packages/message_filters/__init__.py", line 75, in callback
    self.signalMessage(msg)

  File "/opt/ros/kinetic/lib/python2.7/dist-packages/message_filters/__init__.py", line 57, in signalMessage

    cb(*(msg + args))

  File "/opt/ros/kinetic/lib/python2.7/dist-packages/message_filters/__init__.py", line 220, in add
    common = reduce(set.intersection, [set(q) for q in self.queues])

NameError: name 'reduce' is not defined

happens on callback when using message_filters.TimeSynchronizer with python3.

Adding the import should work for both python2 and 3 per https://python-future.org/compatible_idioms.html#reduce

@dirk-thomas
Copy link
Member

Thank you for the patch.

@dirk-thomas dirk-thomas merged commit f5b742c into ros:melodic-devel Mar 14, 2019
tahsinkose pushed a commit to tahsinkose/ros_comm that referenced this pull request Apr 15, 2019
@Fab7c4
Copy link

Fab7c4 commented May 1, 2019

Can this fix also be cherry-picked onto ros:kinetic-devel ?
The approach works fine for my kinetic based setup.

@dirk-thomas
Copy link
Member

@Fab7c4 Kinetic doesn't support Python 3. Backporting single fixes like this won't change this since there are many more which aren't being backported. So I am inclined to say no.

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 this pull request may close these issues.

3 participants