Skip to content

Commit

Permalink
fix bug in socli python2 interactive mode fixes:#14
Browse files Browse the repository at this point in the history
  • Loading branch information
gautamkrishnar committed Jul 6, 2016
1 parent bff9939 commit bdcc08b
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions socli/socli.py
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
from bs4 import BeautifulSoup

# Global vars:
DEBUG = False # Set True for enabling debugging
DEBUG = True # Set True for enabling debugging
soqurl = "http://stackoverflow.com/search?q=" # Query url
sourl = "http://stackoverflow.com" # Site url
rn = -1 # Result number (for -r and --res)
Expand Down Expand Up @@ -187,8 +187,7 @@ def socli_interactive(query):
cnt = 1 # this is because the 1st post is the question itself
while 1:
global tmpsoup
qna = input("Type " + bold("o") + " to open in browser, " + bold("n") + " to next answer, "
+ bold("b") + " for previous answer or any other key to exit:")
qna = raw_input("Type " + bold("o") + " to open in browser, " + bold("n") + " to next answer, "+ bold("b") + " for previous answer or any other key to exit:")
if qna in ["n", "N"]:
try:
answer = (tmpsoup.find_all("div",class_="post-text")[cnt + 1].get_text())
Expand Down Expand Up @@ -217,9 +216,9 @@ def socli_interactive(query):
sys.exit(0)
else:
op = int(input("\n\nWrong option. select the option no to continue:"))
except Exception:
except Exception as e:
print_warning("\n Exiting...")
sys.exit(1)
sys.exit(0)
except IndexError:
print_warning("No results found...")
sys.exit(1)
Expand Down

0 comments on commit bdcc08b

Please sign in to comment.