eshapard / AnkiHabitica

Anki 2.0/2.1 add-on for use with HabitRPG. Automatically scores habits when you reach the end of your Anki timebox and when you review all cards in a deck.
GNU General Public License v3.0
197 stars 31 forks source link

Startup AnkiHabitica Error When UserID include extra spaces or newlines #82

Closed Kosezu closed 4 years ago

Kosezu commented 5 years ago

Error An error occurred. Please start Anki while holding down the shift key, which will temporarily disable the add-ons you have installed. If the issue only occurs when add-ons are enabled, please use the Tools>Add-ons menu item to disable some add-ons and restart Anki, repeating until you discover the add-on that is causing the problem. When you've discovered the add-on that is causing the problem, please report the issue on the add-ons section of our support site. Debug info: Anki 2.1.16 (2e7b7560) Python 3.6.7 Qt 5.12.1 PyQt 5.11.3 Platform: Mac 10.15.1 Flags: frz=True ao=True sv=2 Add-ons possibly involved: Anki Habitica for 21

Caught exception: Traceback (most recent call last): File "aqt/main.py", line 186, in onOpenProfile File "", line 2, in loadProfile File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 69, in repl File "", line 2, in loadProfile File "anki/hooks.py", line 74, in decorator_wrapper File "anki/hooks.py", line 65, in repl File "aqt/main.py", line 276, in loadProfile File "anki/hooks.py", line 29, in runHook File "/Users/csosborn/Library/Application Support/Anki2/addons21/1758045507/init.py", line 710, in grab_profile if ah.user_settings["check_db_on_profile_load"] and ah.settings.configured and ah.habitica.grab_scorecounter() and compare_score_to_db(): File "/Users/csosborn/Library/Application Support/Anki2/addons21/1758045507/habitica_class.py", line 376, in grab_scorecounter response = self.api.task(self.habit_id) File "/Users/csosborn/Library/Application Support/Anki2/addons21/1758045507/habitica_api.py", line 91, in task out = self.v3_request("get", "/tasks/%s" % str(task_id)) File "/Users/csosborn/Library/Application Support/Anki2/addons21/1758045507/habitica_api.py", line 60, in v3_request response = json.load(urllib.request.urlopen(req, timeout=timeout, context=context)) File "urllib/request.py", line 223, in urlopen File "urllib/request.py", line 526, in open File "urllib/request.py", line 544, in _open File "urllib/request.py", line 504, in _call_chain File "urllib/request.py", line 1361, in https_open File "urllib/request.py", line 1318, in do_open File "http/client.py", line 1239, in request File "http/client.py", line 1280, in _send_request File "http/client.py", line 1217, in putheader ValueError: Invalid header value b'09102132-3908-4454-be34-0db9e042a932\n'

71e6fd52 commented 5 years ago

You didn't set the User ID and API Token properly. These should not have extra spaces or newlines.

71e6fd52 commented 4 years ago

e76f1e75