From 9745cfc9bec8640a43660769670cfef585c6fd36 Mon Sep 17 00:00:00 2001 From: "Brian S. Stephan" Date: Tue, 21 Jun 2011 17:24:31 -0500 Subject: [PATCH] Twitter: catch ValueError if the provided index isn't a number at all --- modules/Twitter.py | 13 +++++++++---- 1 file changed, 9 insertions(+), 4 deletions(-) diff --git a/modules/Twitter.py b/modules/Twitter.py index 368f744..b448e6b 100644 --- a/modules/Twitter.py +++ b/modules/Twitter.py @@ -138,12 +138,17 @@ class Twitter(Module): user = match.group(1) index = match.group(2) - if index: - index = int(index) - if index > 0: + try: + if index: + index = int(index) + if index > 0: + index = 0 + else: index = 0 - else: + except ValueError as e: + print('Couldn\'t convert index: ' + str(e)) index = 0 + count = (-1*index) + 1 try: