+2006-08-17 Bob Halley <halley@dnspython.org>
+
+ * dns/resolver.py (Resolver.read_resolv_conf): If /etc/resolv.conf
+ doesn't exist, just use the default resolver configuration (i.e.
+ the same thing we would have used if resolv.conf had existed and
+ been empty).
+
2006-07-26 Bob Halley <halley@dnspython.org>
* dns/resolver.py (Resolver._config_win32_fromkey): fix
a string, it is used as the name of the file to open; otherwise it
is treated as the file itself."""
if isinstance(f, str) or isinstance(f, unicode):
- f = open(f, 'r')
+ try:
+ f = open(f, 'r')
+ except IOError:
+ # /etc/resolv.conf doesn't exist, can't be read, etc.
+ # We'll just use the default resolver configuration.
+ self.nameservers = ['127.0.0.1']
+ return
want_close = True
else:
want_close = False