From 1893f0528b9db8ad2c17cee38162de8905c8e5c9 Mon Sep 17 00:00:00 2001 From: Alexey Rogachevskiy Date: Mon, 12 Oct 2020 20:18:12 +0300 Subject: [PATCH] clover: Fix importing urllib for Python3 --- clover/test/basic.py | 9 +++++++-- 1 file changed, 7 insertions(+), 2 deletions(-) diff --git a/clover/test/basic.py b/clover/test/basic.py index fe546f7d..bc3646b5 100755 --- a/clover/test/basic.py +++ b/clover/test/basic.py @@ -26,8 +26,13 @@ def test_simple_offboard_services_available(): rospy.wait_for_service('land', timeout=5) def test_web_video_server(node): - import urllib2 - urllib2.urlopen("http://localhost:8080").read() + try: + # Python 2 + import urllib2 as urllib + except ModuleNotFoundError: + # Python 3 + import urllib.request as urllib + urllib.urlopen("http://localhost:8080").read() def test_shell(node): execute = rospy.ServiceProxy('exec', srv.Execute)