Consider the unsurprising:
$ python
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.sax
>>> xml.sax.parse('pypi.rss', xml.sax.ContentHandler())
>>>
Now predict the behavior of the preceeding code snippet after this shell interaction:
# ifdown eth1
If you guessed this:
$ python
Python 2.4.3 (#2, Oct 6 2006, 07:52:30)
[GCC 4.0.3 (Ubuntu 4.0.3-1ubuntu5)] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import xml.sax
>>> xml.sax.parse('pypi.rss', xml.sax.ContentHandler())
Traceback (most recent call last):
File "", line 1, in ?
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/__init__.py", line 31, in parse
parser.parse(filename_or_stream)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 109, in parse
xmlreader.IncrementalParser.parse(self, source)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/xmlreader.py", line 123, in parse
self.feed(buffer)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 216, in feed
self._parser.Parse(data, isFinal)
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/expatreader.py", line 395, in external_entity_ref
self._source.getSystemId() or
File "/usr/lib/python2.4/site-packages/_xmlplus/sax/saxutils.py", line 523, in prepare_input_source
f = urllib2.urlopen(source.getSystemId())
File "/usr/lib/python2.4/urllib2.py", line 130, in urlopen
return _opener.open(url, data)
File "/usr/lib/python2.4/urllib2.py", line 358, in open
response = self._open(req, data)
File "/usr/lib/python2.4/urllib2.py", line 376, in _open
'_open', req)
File "/usr/lib/python2.4/urllib2.py", line 337, in _call_chain
result = func(*args)
File "/usr/lib/python2.4/urllib2.py", line 1021, in http_open
return self.do_open(httplib.HTTPConnection, req)
File "/usr/lib/python2.4/urllib2.py", line 996, in do_open
raise URLError(err)
urllib2.URLError: <urlopen error (-2, 'Name or service not known')>
Give yourself a pat on the back.