X-Git-Url: http://gitweb.pimeys.fr/?a=blobdiff_plain;f=today_server.py;h=80407293c42286e7a0e39749790f934aa847ea71;hb=6f28d79c1a3532cd94daea5220be5239e71c9510;hp=fbd650f1d109b7d02def75a06c4417880be91f41;hpb=b786fa6bc6d8b8d92d13a680da857a62d8fccef2;p=today.git diff --git a/today_server.py b/today_server.py index fbd650f..8040729 100755 --- a/today_server.py +++ b/today_server.py @@ -18,6 +18,8 @@ import sys import urllib import json import traceback +import inspect +import pprint os.chdir('/home/vincent/scripts/today/') sys.path.append("/home/vincent/scripts/dtc/") import dtc @@ -102,14 +104,15 @@ def last_noob_warpzone(): for serie in [noobs, warpzones]: # Les titres sont dans l'ordre antichronologique, on s'arrête donc au premier qu'on comprend for titre in serie: - if "noob le film" in titre or "making of" in titre: + if "noob le film" in titre or "making of" in titre or "noob versus rct" == titre: continue try: if DEBUG: print titre saison, ep = get_season_episode(titre) - except ValueError: - pass + except (ValueError, IndexError) as e: + print "%s sur un season_episode warpzone : %s\n" % (e, titre) + continue lasts.append([saison, ep]) del saison, ep break @@ -182,8 +185,18 @@ def fetch_all(): try: news[k] = f() except Exception as e: - print "Erreur à la récupération de %s :" % k - traceback.print_exc() + errmsg = "Erreur à la récupération de %s :\n" % k + errmsg += traceback.format_exc() + # On dumpe le contenu local de la mémoire au moment de l'exception + fobj = inspect.trace()[-1][0] + # On fait un peu de ménage + d = {k:v for (k,v) in fobj.f_locals.iteritems() if not k.startswith("_")} + # On évite d'envoyer truckLoadsOfShit + d = {k: (v if len(str(v)) < 800 + else str(v)[:400] + "*" * 40 + "TRUNCATED OBJECT" + "*" * 40 + str(v)[-400:]) + for (k,v) in d.iteritems()} + errmsg += "\nContexte : %s\n\n" % (pprint.pformat(d)) + print errmsg return news def sync():