ROS Resources: Documentation | Support | Discussion Forum | Index | Service Status | ros @ Robotics Stack Exchange
Ask Your Question

Revision history [back]

click to hide/show revision 1
initial version

When you're looking for a file using file:// like http:// usually you need 3 slashes to tell it that it's a absolute url. try "file:///home/username/path/path/filename.stl" if you don't the first argument after the slashes is considered the hostname.

Python 2.6.5 (r265:79063, Apr 16 2010, 13:57:41) 
[GCC 4.4.3] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import urllib
>>> urllib.urlopen('file:///tmp/foo')
<addinfourl at 17115976 whose fp = <open file '/tmp/foo', mode 'rb' at 0x7f449c12aae0>>
>>> urllib.urlopen('file://tmp/foo')
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/usr/lib/python2.6/urllib.py", line 86, in urlopen
    return opener.open(url)
  File "/usr/lib/python2.6/urllib.py", line 205, in open
    return getattr(self, name)(url)
  File "/usr/lib/python2.6/urllib.py", line 465, in open_file
    return self.open_ftp(url)
  File "/usr/lib/python2.6/urllib.py", line 522, in open_ftp
    host = socket.gethostbyname(host)
IOError: [Errno socket error] [Errno -2] Name or service not known