Skip to content

Commit 253ea5a

Browse files
committed
Suppress a deprecation warning from ROS
1 parent 6d674e5 commit 253ea5a

File tree

1 file changed

+6
-2
lines changed

1 file changed

+6
-2
lines changed

src/velodyne_decoder/util.py

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@
33

44
import struct
55
from contextlib import contextmanager
6+
import warnings
67

78
import dpkt
89
import numpy as np
@@ -28,8 +29,11 @@ def iter_pcap(pcap_file, time_range=(None, None)):
2829

2930

3031
def iter_bag(bag_file, topics=None, default_msg_types=None, time_range=(None, None)):
31-
from rosbag import Bag
32-
from rospy import Time
32+
with warnings.catch_warnings():
33+
# Suppress an irrelevant deprecation warning from the Cryptodome package due to 'import imp'
34+
warnings.filterwarnings("ignore", category=DeprecationWarning)
35+
from rosbag import Bag
36+
from rospy import Time
3337

3438
if isinstance(bag_file, Bag):
3539
bag = bag_file

0 commit comments

Comments
 (0)