Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Invalid Syntax jose.py

Tags:

python

jose

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?

like image 240
Gihan Gamage Avatar asked Dec 02 '20 06:12

Gihan Gamage


People also ask

How do you fix invalid syntax in Python?

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.

Why does Python keep saying invalid syntax?

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.

What does Pyflakes invalid syntax mean?

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"))

How do you find the SyntaxError in Python?

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).


1 Answers

installing python-jose instead of jose fixed my problem. https://pypi.org/project/python-jose/

like image 108
Gihan Gamage Avatar answered Sep 25 '22 03:09

Gihan Gamage