Python urllib2 problem: Name or service not known

Alex Borghgraef alexander.borghgraef at gmail.com
Mon Feb 27 21:48:27 CET 2012


Hi all,

Some time ago I've written some python code to read video data off an
IP camera connected via a router to a laptop. Now I try to run this
code on a different laptop and router combination, but now I can't
access the camera.
Some minimal example code:

  import urllib2

  url = urllib2.urlopen("http://192.168.1.3/-wvhttp-01-/image.cgi")

This fails and returns the error:

  <urlopen error [Errno -2] Name or service not known

When I check further, I cannot access any url via urllib2.urlopen, not
the camera nor the router nor localhost. Pinging them poses no problem
though, and I can access the video feed and the router admin page in
firefox without any issues. I run kubuntu 11.10 on the laptop, the
router is not connected to the internet and serves as dhcp server for
both the laptop and the camera. Any suggestions what may be causing
this? In what manner does urlopen access ip addresses differently from
ping or firefox?

--
Alex



More information about the Python-list mailing list