Exaphis / HackQ-Trivia

Yet another HQ Trivia bot. Automatically scrapes HQ Trivia questions without OCR and answers them.
MIT License
89 stars 54 forks source link

bearer finder TypeError: 'NoneType' object is not subscriptable #183

Closed KianBrose closed 4 years ago

KianBrose commented 4 years ago

Hello there! I just finished setting up everything as the README file said, entered the google search API token and GoogleCseId, but when I try to run python hackq_trivia/bearer_finder.py (Note: I am using python 3.7.0 64 bit) I get the following error

tt

temp

did I miss anything?

Exaphis commented 4 years ago

Interesting. I've added logging to bearer_finder.py. Get the new version and report back with your data.log file. Make sure to follow the new bearer_finder instructions in the README.

KianBrose commented 4 years ago

Hello! I downloaded the latest Master commit and tried running python hackq_trivia.bearer_finder output: (null): can't open file 'hackq_trivia.bearer_finder': [Errno 2] No such file or directory

I changed the command to this: python hackq_trivia/bearer_finder.py (Since this points to the bearer finder file) The code did not output a data.log file but gave this error instead

C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master>python hackq_trivia/bearer_finder.py
Traceback (most recent call last): File "hackq_trivia/bearer_finder.py", line 6, in from hackq_trivia.hq_main import init_root_logger ModuleNotFoundError: No module named 'hackq_trivia'

Running python hackq_trivia/bearer_finder.py with -m gives this output: C:\Users\Kian\AppData\Local\Programs\Python\Python37\python.exe: Error while finding module specification for 'hackq_trivia/bearer_finder.py' (ModuleNotFoundError: No module named 'hackq_trivia/bearer_finder')

Exaphis commented 4 years ago

Should be python -m hackq_trivia.bearer_finder, not python hackq_trivia.bearer_finder.

KianBrose commented 4 years ago

Output of python -m hackq_trivia.bearer_finder

Traceback (most recent call last): File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\corpus\util.py", line 83, in __load root = nltk.data.find("{}/{}".format(self.subdir, zip_name)) File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\data.py", line 585, in find raise LookupError(resource_not_found) LookupError: ** Resource stopwords not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('stopwords')  For more information see: https://www.nltk.org/data.html Attempted to load corpora/stopwords.zip/stopwords/ Searched in: - 'C:\Users\Kian/nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\share\nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\nltk_data' - 'C:\Users\Kian\AppData\Roaming\nltk_data' - 'C:\nltk_data' - 'D:\nltk_data' - 'E:\nltk_data' ** During handling of the above exception, another exception occurred: Traceback (most recent call last): File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master\hackq_trivia\bearer_finder.py", line 6, in from hackq_trivia.hq_main import init_root_logger File "C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master\hackq_trivia\hq_main.py", line 14, in from hackq_trivia.live_show import LiveShow File "C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master\hackq_trivia\live_show.py", line 9, in from hackq_trivia.question_handler import QuestionHandler File "C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master\hackq_trivia\question_handler.py", line 14, in class QuestionHandler: File "C:\Users\Kian\Desktop\HackQ-Trivia-master (1)\HackQ-Trivia-master\hackq_trivia\question_handler.py", line 15, in QuestionHandler STOPWORDS = set(nltk.corpus.stopwords.words('english')) - {'most', 'least'} File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\corpus\util.py", line 120, in getattr self.load() File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\corpus\util.py", line 85, in load raise e File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\corpus\util.py", line 80, in load root = nltk.data.find("{}/{}".format(self.subdir, self.name)) File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\site-packages\nltk\data.py", line 585, in find raise LookupError(resource_not_found) LookupError: ** Resource stopwords not found. Please use the NLTK Downloader to obtain the resource: >>> import nltk >>> nltk.download('stopwords')  For more information see: https://www.nltk.org/data.html Attempted to load corpora/stopwords Searched in: - 'C:\Users\Kian/nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\share\nltk_data' - 'C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\nltk_data' - 'C:\Users\Kian\AppData\Roaming\nltk_data' - 'C:\nltk_data' - 'D:\nltk_data' - 'E:\nltk_data' **

Exaphis commented 4 years ago

Fixed, pull the repo and try again. Alternatively follow the steps in the error message to download the resource.

KianBrose commented 4 years ago

Ran the command on the new version

Here is the output: Your bearer token is: Traceback (most recent call last): File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 193, in _run_module_as_main "main", mod_spec) File "C:\Users\Kian\AppData\Local\Programs\Python\Python37\lib\runpy.py", line 85, in _run_code exec(code, run_globals) File "C:\Users\Kian\Desktop\HackQ-Trivia-master (2)\HackQ-Trivia-master\hackq_trivia\bearer_finder.py", line 65, in main() File "C:\Users\Kian\Desktop\HackQ-Trivia-master (2)\HackQ-Trivia-master\hackq_trivia\bearer_finder.py", line 59, in main print(auth_resp['auth']['authToken']) TypeError: 'NoneType' object is not subscriptable

Here is the log file data.log

I removed my phone number for privacy reasons, though I would comment my phone begins with +46 (swedish extension)

Exaphis commented 4 years ago

Hmmm, can't seem to reproduce. You have logged into HQ Trivia with the account registered to this phone number, right?

KianBrose commented 4 years ago

Yes, I tried uninstalling and reinstalling python 3.7 and it seems to work properly now