sushant10 / hq_bot Goto Github PK
View Code? Open in Web Editor NEW📲 Bot to help solve HQ trivia
License: MIT License
📲 Bot to help solve HQ trivia
License: MIT License
can someone plz make a video or a more detailed instruction on how to build it
Im new to this, is there anyway someone could make a video?
So I can open the script and it runs, but when I press S and then Enter, it pops up with this
Traceback (most recent call last):
File "answer_bot.py", line 342, in
keypressed = input(bcolors.WARNING +'\nPress s to screenshot live game, sampq to run against sample questions or q to quit:\n' + bcolors.ENDC)
File "", line 1, in
NameError: name 's' is not defined
I am not sure, but I think it's saying that S is not bound to a line of code?
Someone please help
I don't understand this error.
sherlock@sherlock
~/Documents/HQ_Bot-master $ python3 answer_bot.py
Press s to screenshot live game, sampq to run against sample questions or q to quit:
s
Traceback (most recent call last):
File "answer_bot.py", line 271, in
get_points_live()
File "answer_bot.py", line 249, in get_points_live
question,options=parse_question()
File "answer_bot.py", line 106, in parse_question
text = read_screen()
File "answer_bot.py", line 88, in read_screen
text = pytesseract.image_to_string(Image.open(filename))
File "/usr/local/lib/python3.5/dist-packages/pytesseract/pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "/usr/local/lib/python3.5/dist-packages/pytesseract/pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "/usr/local/lib/python3.5/dist-packages/pytesseract/pytesseract.py", line 116, in run_tesseract
raise TesseractError(status_code, get_errors(error_string))
pytesseract.pytesseract.TesseractError: (1, 'Error opening data file /usr/local/share/tessdata/eng.traineddata Please make sure the TESSDATA_PREFIX environment variable is set to your "tessdata" directory. Failed loading language 'eng' Tesseract couldn't load any languages! Could not initialize tesseract.'`
Guys, I set this all up and idk what step I'm doing wrong but the screenshot isn't reading the text properly. On some screenshots it picks up half the text and like choice A, on some it picks up nothing, and therefore it isn't really giving me proper answers either. Anyone have any suggestions on what I'm doing wrong?
Keep getting this error, everything is up-to-date.
raceback (most recent call last):
File "answer_bot.py", line 23, in
import cv2
File "/usr/local/lib/python3.6/site-packages/cv2/init.py", line 4, in
from .cv2 import *
ImportError: dlopen(/usr/local/lib/python3.6/site-packages/cv2/cv2.cpython-36m-darwin.so, 2): Symbol not found: _clock_gettime
Referenced from: /usr/local/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib (which was built for Mac OS X 10.12)
Expected in: /usr/lib/libSystem.B.dylib
in /usr/local/lib/python3.6/site-packages/cv2/.dylibs/libavutil.55.78.100.dylib
I'm getting an error for bs4. I've tried testing on the rest of the stuff, but it doesn't work for google or PIL. Here's the exact error message:
Traceback (most recent call last):
File "answer_bot.py", line 18, in
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
It would be great if you could help me with this issue, feel free to ask me for any more information you might need. The file is currently on my desktop, which is probably the reason that it can't find the modules. I'm on a macbook air. Thank you!
Where do I type 2nd step in python? Syntax Error everytime.
Program can't read the text unfortunately. I get a [WinError 2] error. Anyone know what to do??
D:\HQ_Bot-master>py answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 19, in
from google import google
ImportError: cannot import name 'google'
C:\Users\Hari\HQ_Bot>python answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 263, in
load_json()
File "answer_bot.py", line 53, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
File "C:\Users\Hari\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 94: character maps to undefined
HI i am using Windows and php and getting this error
C:\Users\wader\HQ_Bot>pip3 install -r requirements.txt
Requirement already satisfied: simplejson in c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 1))
Collecting Google-Search-API (from -r requirements.txt (line 2))
Using cached Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\extern_init_.py:1: UserWarning: Module google was already imported from None, but c:\users\wader\appdata\local\temp\pip-build-3dx_4ub1\google-search-api is being added to sys.path
from pkg_resources.extern import VendorImporter
Traceback (most recent call last):
File "", line 1, in
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\setuptools_init_.py", line 10, in
from setuptools.extern.six.moves import filter, map
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\setuptools\extern_init_.py", line 1, in
from pkg_resources.extern import VendorImporter
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init_.py", line 3147, in
@call_aside
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init.py", line 3131, in call_aside
f(*args, **kwargs)
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init.py", line 3175, in initialize_master_working_set
for dist in working_set
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init.py", line 3175, in
for dist in working_set
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init_.py", line 2701, in activate
declare_namespace(pkg)
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init_.py", line 2260, in declare_namespace
handle_ns(packageName, path_item)
File "c:\users\wader\appdata\local\programs\python\python36-32\lib\site-packages\pkg_resources_init.py", line 2195, in handle_ns
loader.load_module(packageName)
File ".\google_init.py", line 1, in
from modules import calculator, currency, images, utils
ModuleNotFoundError: No module named 'modules'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in C:\Users\wader\AppData\Local\Temp\pip-build-3dx_4ub1\Google-Search-API\
Collecting google-search-api
Using cached Google-Search-API-1.1.13.tar.gz
Complete output from command python setup.py egg_info:
Traceback (most recent call last):
File "", line 1, in
File "/tmp/pip-build-5njep_if/google-search-api/setup.py", line 15, in
with open("test_requirements.txt") as f:
FileNotFoundError: [Errno 2] No such file or directory: 'test_requirements.txt'
----------------------------------------
Command "python setup.py egg_info" failed with error code 1 in /tmp/pip-build-5njep_if/google-search-api/
Whenever I run the code, I get this error:
C:\PythonPrograms>python answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 264, in
load_json()
File "answer_bot.py", line 49, in load_json
remove_words = json.loads(open("Data/settings.json").read())["remove_words"]
FileNotFoundError: [Errno 2] No such file or directory: 'Data/settings.json'
I finished step 2. And now I'm stuck. Could any one explain what to do after that step. I'm on a pc btw. Id like to see a tutorial or more detailed instructions. I don't even know how to run it, all I can do is test it and i get the error for bs4 that someone else had. So if someone could give links and some help that be great! I'd paypal some money if someone gets it working for me!
Can someone please make a video tutorial to run this on a windows pc? It would be MUCH apprciated
brew install tesseract command error
'brew' is not recognized as an internal or external command,
operable program or batch file.
my bot used to do the problem in #15 but now show nothing after the question.
please help I need this for Sunday $60k
Traceback (most recent call last):�[0m�[0m�[0m
�[0m�[0m�[0m File "D:\Desktop\HQ_Bot-master\answer_bot.py", line 282, in <module>
load_json()
�[0m�[0m�[0m�[0m�[0m�[0m File "D:\Desktop\HQ_Bot-master\answer_bot.py", line 64, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
�[0m�[0m�[0m�[0m�[0m�[0m File "C:\Users\-\AppData\Local\Programs\Python\Python36\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
�[0m�[0m�[0m�[0m�[0m�[0mUnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 93: character maps to <undefined>
�[0m�[0m�[0m�[0m�[0m�[0m
Errors in loading JSON files but dont want to tamper with what you've made
any help resolving this appreciated...
python answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 276, in
load_json()
File "answer_bot.py", line 63, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
File "C:\Users\user\AppData\Local\Programs\Python\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 94: character maps to
I get the error: "Command "python setup.py egg_info" failed with error code 1 in /private/var/folders/gp/qwhzqxhj3cbg3km5wch278140000gn/T/pip-build-lklrwb02/Google-Search-API/"
when I run pip3 install -r requirements.txt
anyone know how to fix this error when i try to run the program ?
had the same problem with bs4 but fixed that one
MacBook-Pro:HQ_Bot user$ python3 answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 19, in
from google import google
ModuleNotFoundError: No module named 'google'
MacBook-Pro:HQ_Bot user$
It's showing 0 percentage for all three results plz help
============= RESTART: C:\Python36\Scripts\HQ_Bot\answer_bot.py =============
�[93m
Press s to screenshot live game, sampq to run against sample questions or q to quit:
�[0msampq
�[92mMinky Mantel�[0m { points: �[1m-3�[0m }
Jackie Robinson { points: �[1m-1303�[0m }
Roy Campanella { points: �[1m-1111�[0m }
issues:
please give slution as soon as possible bro
D:\WorkStation\Test Zone\HQ_Bot-master>python answer_bot.py
�[93m
Press s to screenshot live game, sampq to run against sample questions or q to quit:
�[0ms
Traceback (most recent call last):
File "answer_bot.py", line 281, in
get_points_live()
File "answer_bot.py", line 259, in get_points_live
question,options=parse_question()
File "answer_bot.py", line 116, in parse_question
text = read_screen()
File "answer_bot.py", line 98, in read_screen
text = pytesseract.image_to_string(Image.open(filename))
File "C:\Users\ZeroByteDNA\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "C:\Users\ZeroByteDNA\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\ZeroByteDNA\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "C:\Users\ZeroByteDNA\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "C:\Users\ZeroByteDNA\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
Please help.
Traceback (most recent call last):
File "answer_bot.py", line 277, in
get_points_live()
File "answer_bot.py", line 263, in get_points_live
points,maxo = google_wiki(simq, options, neg)
File "answer_bot.py", line 211, in google_wiki
link = search_wiki[0].link
IndexError: list index out of range
@sushant10 Every time I try installing Google-Search-API or requirments.txt, I get this error:
After the first screenshot, everything is fine, but after typing "s" for the second time (new screenshot) the app errors and quits. I have to Ctrl-C to exit and rerun the app again.
If useful, here's the code produced after python errors out:
Press s to screenshot live game, sampq to run against sample questions or q to quit:
s
^CTraceback (most recent call last):
File "answer_bot.py", line 271, in <module>
get_points_live()
File "answer_bot.py", line 249, in get_points_live
question,options=parse_question()
File "answer_bot.py", line 106, in parse_question
text = read_screen()
File "answer_bot.py", line 65, in read_screen
screen_grab(screenshot_file)
File "answer_bot.py", line 59, in screen_grab
im = Imagegrab.grab(bbox=(31,228,485,590))
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyscreenshot/__init__.py", line 46, in grab
return _grab(to_file=False, childprocess=childprocess, backend=backend, bbox=bbox)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyscreenshot/__init__.py", line 29, in _grab
return run_in_childprocess(_grab_simple, imcodec.codec, to_file, backend, bbox, filename)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/site-packages/pyscreenshot/procutil.py", line 29, in run_in_childprocess
e, r = queue.get()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/queues.py", line 94, in get
res = self._recv_bytes()
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/connection.py", line 216, in recv_bytes
buf = self._recv_bytes(maxlength)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/connection.py", line 407, in _recv_bytes
buf = self._recv(4)
File "/Library/Frameworks/Python.framework/Versions/3.6/lib/python3.6/multiprocessing/connection.py", line 379, in _recv
chunk = read(handle, remaining)
KeyboardInterrupt
Receiving Error:
Traceback (most recent call last):
File "answer_bot.py", line 17, in
from bs4 import BeautifulSoup
ModuleNotFoundError: No module named 'bs4'
Went through installation, and receiving this.
$ pip3 install -r requirements.txt
Requirement already satisfied: simplejson in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 1))
Requirement already satisfied: Google-Search-API in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 2))
Requirement already satisfied: Pillow in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 3))
Requirement already satisfied: opencv-contrib-python in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 4))
Requirement already satisfied: pytesseract in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 5))
Requirement already satisfied: beautifulsoup4 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 6))
Requirement already satisfied: pyscreenshot in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 7))
Requirement already satisfied: lxml in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 8))
Requirement already satisfied: wikipedia in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from -r requirements.txt (line 9))
Requirement already satisfied: selenium<3.0.0,>=2.44.0 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: requests in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: unidecode in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: vcrpy in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: future in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: numpy>=1.11.3 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from opencv-contrib-python->-r requirements.txt (line 4))
Requirement already satisfied: EasyProcess in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from pyscreenshot->-r requirements.txt (line 7))
Requirement already satisfied: idna<2.7,>=2.5 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: certifi>=2017.4.17 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: urllib3<1.23,>=1.21.1 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: chardet<3.1.0,>=3.0.2 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from requests->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: wrapt in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from vcrpy->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: yarl; python_version in "3.4, 3.5, 3.6" in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from vcrpy->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: PyYAML in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from vcrpy->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: six>=1.5 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from vcrpy->Google-Search-API->-r requirements.txt (line 2))
Requirement already satisfied: multidict>=4.0 in c:\users\gandalf\appdata\local\programs\python\python36-32\lib\site-packages (from yarl; python_version in "3.4, 3.5, 3.6"->vcrpy->Google-Search-API->-r requirements.txt (line 2))
Gandalf@DESKTOP-VB16S55 MINGW64 ~/Desktop/HQ_Bot (master)
$ python3 answer_bot.py
bash: python3: command not found
Traceback (most recent call last):
File "reader.py", line 262, in
load_json()
File "reader.py", line 49, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
File "C:\Python36\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 94: character maps to
hey sushant10,
i was working on my own "bot" as well for hq-trivia. I did not figure out how use the tesseract ocr, and ended up using goolge vision. i would like to test this out and maybe implement it on your version, since it is well developed. I will let you know of the results.
How do i install it on windows? Please help
Traceback (most recent call last):
File "answer_bot.py", line 286, in
/ Reading screenget_points_live()
File "answer_bot.py", line 264, in get_points_live
question,options=parse_question()
File "answer_bot.py", line 118, in parse_question
text = read_screen()
File "answer_bot.py", line 100, in read_screen
text = pytesseract.image_to_string(Image.open(filename))
File "C:\Users\vikash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "C:\Users\vikash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Users\vikash\AppData\Local\Programs\Python\Python36-32\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE)
File "C:\Users\vikash\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "C:\Users\vikash\AppData\Local\Programs\Python\Python36-32\lib\subprocess.py", line 997, in _execute_child
startupinfo)
FileNotFoundError: [WinError 2] The system cannot find the file specified
plzzz help
C:\Users\julia\Desktop\hqbot>python answer_bot.py
Traceback (most recent call last):
File "answer_bot.py", line 282, in
load_json()
File "answer_bot.py", line 64, in load_json
sample_questions = json.loads(open("Data/questions.json").read())
File "C:\Python36-32\lib\encodings\cp1252.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
UnicodeDecodeError: 'charmap' codec can't decode byte 0x9d in position 93: character maps to
File "answer_bot.py", line 267, in
get_points_live()
File "answer_bot.py", line 245, in get_points_live
question,options=parse_question()
File "answer_bot.py", line 102, in parse_question
text = read_screen()
File "answer_bot.py", line 84, in read_screen
text = pytesseract.image_to_string(Image.open(filename))
File "C:\Python36\lib\site-packages\pytesseract\pytesseract.py", line 193, in image_to_string
return run_and_get_output(image, 'txt', lang, config, nice)
File "C:\Python36\lib\site-packages\pytesseract\pytesseract.py", line 140, in run_and_get_output
run_tesseract(**kwargs)
File "C:\Python36\lib\site-packages\pytesseract\pytesseract.py", line 111, in run_tesseract
proc = subprocess.Popen(command, stderr=subprocess.PIPE, shell=True)
File "C:\Python36\lib\subprocess.py", line 709, in init
restore_signals, start_new_session)
File "C:\Python36\lib\subprocess.py", line 998, in _execute_child
startupinfo)
PermissionError: [WinError 5] Access is denied
I've tried running cmd as an admin and still no luck
What about a fix for this issue #15
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.