You are viewing a plain text version of this content. The canonical link for it is here.
Posted to commits@community.apache.org by ni...@apache.org on 2013/09/07 12:54:26 UTC
svn commit: r1520756 - /comdev/nearby_people/nearby/foaf.py
Author: nick
Date: Sat Sep 7 10:54:26 2013
New Revision: 1520756
URL: http://svn.apache.org/r1520756
Log:
More error handling - remote server with FOAF file might be down too
Modified:
comdev/nearby_people/nearby/foaf.py
Modified: comdev/nearby_people/nearby/foaf.py
URL: http://svn.apache.org/viewvc/comdev/nearby_people/nearby/foaf.py?rev=1520756&r1=1520755&r2=1520756&view=diff
==============================================================================
--- comdev/nearby_people/nearby/foaf.py (original)
+++ comdev/nearby_people/nearby/foaf.py Sat Sep 7 10:54:26 2013
@@ -89,9 +89,12 @@ class FOAF(object):
sys.stderr.write("Missing FOAF file %s\n" % people_rel_uri)
else:
file = None
- usock = urllib.urlopen(uri)
- self._parse_foaf(usock, uri)
- usock.close()
+ try:
+ usock = urllib.urlopen(uri)
+ self._parse_foaf(usock, uri)
+ usock.close()
+ except IOError, e:
+ sys.stderr.write("Skipping %s due to broken server: %s\n" % (uri,e))
self.updated_at = datetime.datetime.utcnow()
@@ -108,7 +111,7 @@ class FOAF(object):
try:
foaf = parse(data)
- except Exception as e:
+ except Exception, e:
sys.stderr.write("Skipping %s due to invalid/corrupt file: %s\n" % (filename,e))
return None