I was trying to use jose library for authentication for one of my flask apps. using the import statement as follows
from jose import jwt
But it throws following An error,
Traceback (most recent call last):
File "F:/XXX_XXX/xxxx-services-web/src/auth.py", line 6, in <module>
from jose import jwt
File "F:\Users\XXXX_XXXXX\AppData\Local\Programs\Python\Python37\lib\site-packages\jose.py", line 546
print decrypt(deserialize_compact(jwt), {'k':key},
^
SyntaxError: invalid syntax
Is this library outdated?
You can clear up this invalid syntax in Python by switching out the semicolon for a colon. Here, once again, the error message is very helpful in telling you exactly what is wrong with the line.
Syntax errors are produced by Python when it is translating the source code into byte code. They usually indicate that there is something wrong with the syntax of the program. Example: Omitting the colon at the end of a def statement yields the somewhat redundant message SyntaxError: invalid syntax.
if variable > 10 print(variable + str(" > 10")) # there is no ":" next to the 10 in the 1st line, that will activate an error which is "SyntaxError : invalid syntax" # [pyflakes] significate something is missing in your code. if variable > 10. print(variable + str(" > 10"))
Python error checker tool allows to find syntax errors (lint). You can test your Python code online directly in your browser. If a syntax error is detected, then the line in error is highlighted, and it jumps to it to save time (no need to search the line).
installing python-jose instead of jose fixed my problem. https://pypi.org/project/python-jose/
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With