34 import roslib; roslib.load_manifest(
'resource_retriever')
38 from urllib.request
import urlopen
39 from urllib.error
import URLError
41 from urllib2
import urlopen
42 from urllib2
import URLError
44 PACKAGE_PREFIX =
'package://' 49 if url.find(PACKAGE_PREFIX) == 0:
50 mod_url = url[len(PACKAGE_PREFIX):]
51 pos = mod_url.find(
'/')
53 raise Exception(
"Could not parse package:// format into file:// format for " + url)
55 package = mod_url[0:pos]
56 mod_url = mod_url[pos:]
57 package_path = r.get_path(package)
63 mod_url = protocol + package_path + mod_url;
69 return urlopen(filename).read()
71 raise Exception(
"Invalid URL: {}".format(filename))
def get_filename(url, use_protocol=True)