ImportError: bad magic number in 'rosbag': b'\x03\xf3\r\n'
I am trying to run the python file called 'bag_parse.py' that imports rosbag package using the following command:
python bag_parse.py
My Python file is simple for testing:
import rosbag
bag = rosbag.Bag('scan_odom1.bag')
for topic, msg, t in bag.read_messages(topics=['/odom']):
print(msg)
bag.close()
I get the following error:
ImportError: bad magic number in 'rosbag': b'\x03\xf3\r\n'
ROS distribution: Melodic