aboutsummaryrefslogtreecommitdiff
path: root/wqflask
diff options
context:
space:
mode:
Diffstat (limited to 'wqflask')
-rw-r--r--wqflask/base/trait.py3
-rw-r--r--wqflask/db/call.py11
2 files changed, 10 insertions, 4 deletions
diff --git a/wqflask/base/trait.py b/wqflask/base/trait.py
index 05b272c3..a19b66f7 100644
--- a/wqflask/base/trait.py
+++ b/wqflask/base/trait.py
@@ -6,7 +6,6 @@ import resource
import codecs
import requests
import random
-import urllib.request, urllib.parse, urllib.error
from base import webqtlConfig
from base.webqtlCaseData import webqtlCaseData
@@ -607,4 +606,4 @@ def retrieve_trait_info(trait, dataset, get_qtl_info=False):
else:
raise KeyError(repr(trait.name)+' information is not found in the database.')
- return trait \ No newline at end of file
+ return trait
diff --git a/wqflask/db/call.py b/wqflask/db/call.py
index 3b8f782e..0971d2a2 100644
--- a/wqflask/db/call.py
+++ b/wqflask/db/call.py
@@ -3,7 +3,10 @@
from flask import g
import string
-import urllib.request, urllib.error, urllib.parse
+try: # Python2 support
+ import urllib.request, urllib.error, urllib.parse
+except:
+ import urllib2
import json
from utility.tools import USE_GN_SERVER, LOG_SQL, GN_SERVER_URL
from utility.benchmark import Bench
@@ -59,7 +62,11 @@ def gn_server(path):
"""
with Bench("GN_SERVER", LOG_SQL):
- res = urllib.request.urlopen(GN_SERVER_URL+path)
+ res = ()
+ try:
+ res = urllib.request.urlopen(GN_SERVER_URL+path)
+ except:
+ res = urllib2.urlopen(GN_SERVER_URL+path)
rest = res.read()
res2 = json.loads(rest)
logger.debug(res2)