s/exc_info=1/exc_info=True/g
This commit is contained in:
parent
6b70fa36c7
commit
d70bd8797a
14 changed files with 28 additions and 28 deletions
|
@ -26,7 +26,7 @@ def get(vk):
|
|||
opener.addheaders = list(zip(headers.keys(), headers.values()))
|
||||
r = opener.open(url)
|
||||
except:
|
||||
logger.info('get failed %s', url, exc_info=1)
|
||||
logger.info('get failed %s', url, exc_info=True)
|
||||
return None
|
||||
sig = r.headers.get('X-Ed25519-Signature')
|
||||
data = r.read()
|
||||
|
@ -56,6 +56,6 @@ def put(sk, data):
|
|||
opener.addheaders = list(zip(headers.keys(), headers.values()))
|
||||
r = opener.open(url, data)
|
||||
except:
|
||||
logger.info('put failed: %s', data, exc_info=1)
|
||||
logger.info('put failed: %s', data, exc_info=True)
|
||||
return False
|
||||
return r.status == 200
|
||||
|
|
|
@ -44,7 +44,7 @@ def can_connect(data):
|
|||
return True
|
||||
except:
|
||||
pass
|
||||
#logger.debug('failed to connect to local node %s', data, exc_info=1)
|
||||
#logger.debug('failed to connect to local node %s', data, exc_info=True)
|
||||
return False
|
||||
|
||||
|
||||
|
@ -102,7 +102,7 @@ class LocalNodesBase(Thread):
|
|||
self.wait(60)
|
||||
except:
|
||||
if self._active:
|
||||
logger.debug('receive failed. restart later', exc_info=1)
|
||||
logger.debug('receive failed. restart later', exc_info=True)
|
||||
self.wait(60)
|
||||
finally:
|
||||
if self._active:
|
||||
|
@ -188,7 +188,7 @@ class LocalNodes4(LocalNodesBase):
|
|||
try:
|
||||
s.sendto(packet + b'\0', sockaddr)
|
||||
except:
|
||||
logger.debug('LocalNodes4.send failed', exc_info=1)
|
||||
logger.debug('LocalNodes4.send failed', exc_info=True)
|
||||
s.close()
|
||||
|
||||
def get_socket(self):
|
||||
|
@ -222,7 +222,7 @@ class LocalNodes6(LocalNodesBase):
|
|||
try:
|
||||
s.sendto(packet + b'\0', sockaddr)
|
||||
except:
|
||||
logger.debug('LocalNodes6.send failed', exc_info=1)
|
||||
logger.debug('LocalNodes6.send failed', exc_info=True)
|
||||
s.close()
|
||||
|
||||
def get_socket(self):
|
||||
|
|
|
@ -44,7 +44,7 @@ def metadata(f, from_=None):
|
|||
elif ext == 'txt':
|
||||
info = txt.info(f)
|
||||
except:
|
||||
logger.debug('failed to load %s info from %s', ext, f, exc_info=1)
|
||||
logger.debug('failed to load %s info from %s', ext, f, exc_info=True)
|
||||
info = {}
|
||||
|
||||
opf_info = {}
|
||||
|
@ -134,6 +134,6 @@ def extract_text(path):
|
|||
elif ext == 'txt':
|
||||
text = txt.extract_text(path)
|
||||
except:
|
||||
logger.debug('failed to extract text from %s', path, exc_info=1)
|
||||
logger.debug('failed to extract text from %s', path, exc_info=True)
|
||||
text = ''
|
||||
return text
|
||||
|
|
|
@ -17,7 +17,7 @@ def info(opf):
|
|||
with open(opf, 'rb') as fd:
|
||||
opf = ET.fromstring(fd.read().decode())
|
||||
except:
|
||||
logger.debug('failed to load opf %s', opf, exc_info=1)
|
||||
logger.debug('failed to load opf %s', opf, exc_info=True)
|
||||
return data
|
||||
ns = '{http://www.idpf.org/2007/opf}'
|
||||
metadata = opf.findall(ns + 'metadata')[0]
|
||||
|
|
|
@ -164,7 +164,7 @@ def info(pdf):
|
|||
if value and _key not in data:
|
||||
data[_key] = value
|
||||
except:
|
||||
logger.debug('FAILED TO PARSE %s', pdf, exc_info=1)
|
||||
logger.debug('FAILED TO PARSE %s', pdf, exc_info=True)
|
||||
|
||||
'''
|
||||
cmd = ['pdfinfo', pdf]
|
||||
|
|
|
@ -48,7 +48,7 @@ def lookup(id):
|
|||
data = read_url(url, timeout=0).decode('utf-8')
|
||||
mods = ET.fromstring(data)
|
||||
except:
|
||||
logger.debug('lookup for %s url: %s failed', id, url, exc_info=1)
|
||||
logger.debug('lookup for %s url: %s failed', id, url, exc_info=True)
|
||||
return info
|
||||
|
||||
title = mods.findall(ns + 'titleInfo')
|
||||
|
|
|
@ -21,7 +21,7 @@ def request(action, data):
|
|||
try:
|
||||
return json.loads(read_url(url, data, timeout=60).decode('utf-8'))['data']
|
||||
except:
|
||||
logger.debug('metadata request failed', exc_info=1)
|
||||
logger.debug('metadata request failed', exc_info=True)
|
||||
return {}
|
||||
|
||||
def find(query):
|
||||
|
|
|
@ -212,7 +212,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|||
if self.headers.get('Content-Encoding') == 'gzip':
|
||||
data = self.gunzip_data(data)
|
||||
except:
|
||||
logger.debug('invalid request', exc_info=1)
|
||||
logger.debug('invalid request', exc_info=True)
|
||||
response_status = (500, 'invalid request')
|
||||
self.write_response(response_status, content)
|
||||
return
|
||||
|
@ -229,7 +229,7 @@ class Handler(http.server.SimpleHTTPRequestHandler):
|
|||
try:
|
||||
action, args = json.loads(data.decode('utf-8'))
|
||||
except:
|
||||
logger.debug('invalid data: %s', data, exc_info=1)
|
||||
logger.debug('invalid data: %s', data, exc_info=True)
|
||||
response_status = (500, 'invalid request')
|
||||
content = {
|
||||
'status': 'invalid request'
|
||||
|
|
12
oml/nodes.py
12
oml/nodes.py
|
@ -117,7 +117,7 @@ class Node(Thread):
|
|||
try:
|
||||
r = directory.get(vk)
|
||||
except:
|
||||
logger.debug('directory failed', exc_info=1)
|
||||
logger.debug('directory failed', exc_info=True)
|
||||
r = None
|
||||
if r and 'id' in r and len(r['id']) == 16:
|
||||
u = self.user
|
||||
|
@ -169,7 +169,7 @@ class Node(Thread):
|
|||
self.online = False
|
||||
return None
|
||||
except:
|
||||
logger.debug('unknown url error', exc_info=1)
|
||||
logger.debug('unknown url error', exc_info=True)
|
||||
self.online = False
|
||||
return None
|
||||
data = r.read()
|
||||
|
@ -304,7 +304,7 @@ class Node(Thread):
|
|||
try:
|
||||
r = self._opener.open(url, timeout=self.TIMEOUT*5)
|
||||
except:
|
||||
logger.debug('openurl failed %s', url, exc_info=1)
|
||||
logger.debug('openurl failed %s', url, exc_info=True)
|
||||
return False
|
||||
if r.getcode() == 200:
|
||||
try:
|
||||
|
@ -343,7 +343,7 @@ class Node(Thread):
|
|||
self.download_speed = size / duration
|
||||
return item.save_file(content)
|
||||
except:
|
||||
logger.debug('download failed %s', url, exc_info=1)
|
||||
logger.debug('download failed %s', url, exc_info=True)
|
||||
return False
|
||||
else:
|
||||
logger.debug('FAILED %s', url)
|
||||
|
@ -358,7 +358,7 @@ class Node(Thread):
|
|||
try:
|
||||
r = self._opener.open(url, timeout=self.TIMEOUT*2)
|
||||
except:
|
||||
logger.debug('openurl failed %s', url, exc_info=1)
|
||||
logger.debug('openurl failed %s', url, exc_info=True)
|
||||
return False
|
||||
code = r.getcode()
|
||||
if code == 200:
|
||||
|
@ -372,7 +372,7 @@ class Node(Thread):
|
|||
icons.clear(key+':')
|
||||
return True
|
||||
except:
|
||||
logger.debug('preview download failed %s', url, exc_info=1)
|
||||
logger.debug('preview download failed %s', url, exc_info=True)
|
||||
elif code == 404:
|
||||
pass
|
||||
else:
|
||||
|
|
|
@ -96,7 +96,7 @@ def api_task(context, request, callback):
|
|||
try:
|
||||
response = f(data)
|
||||
except:
|
||||
logger.debug('FAILED %s %s', action, data, exc_info=1)
|
||||
logger.debug('FAILED %s %s', action, data, exc_info=True)
|
||||
response = json_response(status=500, text='%s failed' % action)
|
||||
else:
|
||||
response = json_response(status=400, text='Unknown action %s' % action)
|
||||
|
|
|
@ -49,7 +49,7 @@ class Tasks(Thread):
|
|||
trigger_event('error', {'error': 'unknown action'})
|
||||
logger.debug('%s done', action)
|
||||
except:
|
||||
logger.debug('task failed', exc_info=1)
|
||||
logger.debug('task failed', exc_info=True)
|
||||
self.q.task_done()
|
||||
|
||||
def join(self):
|
||||
|
|
|
@ -156,7 +156,7 @@ class Tor(object):
|
|||
if self.daemon:
|
||||
self.daemon.shutdown()
|
||||
except:
|
||||
logger.debug('shutdown exception', exc_info=1)
|
||||
logger.debug('shutdown exception', exc_info=True)
|
||||
pass
|
||||
self.connected = False
|
||||
|
||||
|
@ -196,7 +196,7 @@ class Tor(object):
|
|||
try:
|
||||
self.controller.remove_hidden_service(self.dir)
|
||||
except:
|
||||
logger.debug('self.controller.remove_hidden_service fail', exc_info=1)
|
||||
logger.debug('self.controller.remove_hidden_service fail', exc_info=True)
|
||||
state.online = False
|
||||
|
||||
def is_online(self):
|
||||
|
@ -281,7 +281,7 @@ def install_tor():
|
|||
subprocess.call([desktop, '--register-app'], cwd=os.path.dirname(desktop))
|
||||
os.unlink(tar_file)
|
||||
except:
|
||||
logger.debug('tor installation failed', exc_info=1)
|
||||
logger.debug('tor installation failed', exc_info=True)
|
||||
elif sys.platform == 'darwin':
|
||||
ox.makedirs(target)
|
||||
dmg = os.path.join(target, os.path.basename(url))
|
||||
|
@ -300,6 +300,6 @@ def install_tor():
|
|||
subprocess.call(['hdiutil', 'unmount', volume])
|
||||
os.unlink(dmg)
|
||||
except:
|
||||
logger.debug('tor installation failed', exc_info=1)
|
||||
logger.debug('tor installation failed', exc_info=True)
|
||||
else:
|
||||
logger.debug('no way to install TorBrowser on %s so far', sys.platform)
|
||||
|
|
|
@ -210,7 +210,7 @@ def upgrade_app():
|
|||
shutil.rmtree(app)
|
||||
shutil.copytree(bundled_app, app)
|
||||
except:
|
||||
logger.debug('Failed to update Application', exc_info=1)
|
||||
logger.debug('Failed to update Application', exc_info=True)
|
||||
|
||||
def getVersion(data):
|
||||
'''
|
||||
|
|
|
@ -71,4 +71,4 @@ def trigger_event(event, data):
|
|||
try:
|
||||
ws.post(event, data)
|
||||
except:
|
||||
logger.debug('failed to send to ws %s %s %s', ws, event, data, exc_info=1)
|
||||
logger.debug('failed to send to ws %s %s %s', ws, event, data, exc_info=True)
|
||||
|
|
Loading…
Reference in a new issue