Can not import JSONRPC in python3.7 or 3.6 due to types
manortec opened this issue · comments
Traceback (most recent call last):
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/types.py", line 35, in
from typing_extensions import Literal
ModuleNotFoundError: No module named 'typing_extensions'
During handling of the above exception, another exception occurred:
Traceback (most recent call last):
File "run.py", line 8, in
from h5 import app
File "/home/myuser/haoyidian/baike/h5/app.py", line 10, in
from flask_jsonrpc import JSONRPC
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/init.py", line 28, in
from .app import JSONRPC
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/app.py", line 32, in
from .globals import default_jsonrpc_site, default_jsonrpc_site_api
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/globals.py", line 30, in
from .site import JSONRPCSite
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/site.py", line 37, in
from .helpers import get, from_python_type
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/helpers.py", line 32, in
from .types import Types, Object
File "/home/myuser/haoyidian/baike/venv/lib/python3.7/site-packages/flask_jsonrpc/types.py", line 37, in
from typing import Literal # type: ignore # pylint: disable=C0412
ImportError: cannot import name 'Literal' from 'typing' (/usr/lib/python3.7/typing.py)
It could import JSONRPC porperly in python3.8,but not 3.7 or 3.6
@nycholas Thanks! Yes,it works when I used the master version. Before,I used the version on pipy,and that version was not up to date.
This solution worked for me with an additional pip install typing-inspect
in python 3.7.3. Not sure if this is something wrong with the setup.py or a problem specific to a python version range including 3.7.3, but thought I'd leave a note in case it is helpful.
@mrJeppard yes, it have a problem with setup.py... the depence typing-inspect
was added[1][2] after and I didn't update setup.py with them. Let be free to create a new pull request with this modification.
Thank you.
[1] - https://github.com/cenobites/flask-jsonrpc/blob/master/requirements.pip#L10
[2] - a63b126