ros / ros_comm

ROS communications-related packages, including core client libraries (roscpp, rospy, roslisp) and graph introspection tools (rostopic, rosnode, rosservice, rosparam).
http://wiki.ros.org/ros_comm
767 stars 914 forks source link

Not able to open bag from file-like object #1613

Open sripathivenky opened 5 years ago

sripathivenky commented 5 years ago

rosbag/bag.py:1112

def _is_file(self, f): try: return isinstance(f, file) # Python 2 except NameError: import io return isinstance(f, io.IOBase) # Python 3...this will return false in Python 2 always

line 1114 checks for instance of file in case of Python2.7 this causes issue if sile-like object was passed to Bag class.

line 119 of parameter definition says "@param f: filename of bag to open or a stream to read from"

Cause of hard checking with type file in python 2.7 file-like objects can't be passed.

sripathivenky commented 5 years ago

I would be happy to push the fix.

dirk-thomas commented 5 years ago

Please create a pull request with your proposed fix then.