From f2839b727f6fc25059acec462d4b3da33f6c4ccb Mon Sep 17 00:00:00 2001 From: Ivan Kozik Date: Tue, 18 Mar 2014 11:13:51 +0000 Subject: [PATCH] Fix imports for Python 3 --- eg/lxml/parse-tumblr.hy | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/eg/lxml/parse-tumblr.hy b/eg/lxml/parse-tumblr.hy index 3f61719..6b46ecb 100644 --- a/eg/lxml/parse-tumblr.hy +++ b/eg/lxml/parse-tumblr.hy @@ -2,10 +2,13 @@ ;;; Copyright (c) Paul R. Tagliamonte, 2013, MIT/Expat license. -(import [urllib2 [urlopen]] - [lxml [etree]] +(import [lxml [etree]] [sys [argv]]) +(try + (import [urllib.request [urlopen]]) + (catch [ImportError] + (import [urllib2 [urlopen]]))) (defn get-rss-feed-name [tumblr] (kwapply (.format "http://{tumblr}.tumblr.com/rss") {"tumblr" tumblr}))