gastrodon icon indicating copy to clipboard operation
gastrodon copied to clipboard

Unable to import

Open andydoc opened this issue 4 years ago • 1 comments

On a clean restart: import gastrodon produces Traceback (most recent call last): File "<input>", line 1, in <module> File "C:\Program Files\JetBrains\PyCharm Community Edition with Anaconda plugin 2020.1\plugins\python-ce\helpers\pydev\_pydev_bundle\pydev_import_hook.py", line 21, in do_import module = self._system_import(name, *args, **kwargs) File "C:\Users\andyt\anaconda3\envs\Property\lib\site-packages\gastrodon\__init__.py", line 13, in <module> from typing import Dict,GenericMeta,Match ImportError: cannot import name 'GenericMeta' from 'typing' (C:\Users\andyt\anaconda3\envs\Property\lib\typing.py)

running the same in Jupyter gives a little more info: `ImportError Traceback (most recent call last) in ----> 1 import gastrodon

~\anaconda3\lib\site-packages\gastrodon_init_.py in 11 from types import FunctionType,LambdaType,GeneratorType,CoroutineType,FrameType,CodeType,MethodType 12 from types import BuiltinFunctionType,BuiltinMethodType,DynamicClassAttribute,ModuleType,AsyncGeneratorType ---> 13 from typing import Dict,GenericMeta,Match 14 from urllib.error import HTTPError 15 from urllib.parse import urlparse

ImportError: cannot import name 'GenericMeta' from 'typing' (C:\Users\andyt\anaconda3\lib\typing.py)`

andydoc avatar Apr 23 '20 08:04 andydoc

I had the same issue! Some googling lead me to this comment here https://github.com/hsolbrig/PyShEx/issues/17#issuecomment-427557545.

Changing

from typing import Dict,GenericMeta,Match

to

from typing import Dict,Match 

try:
    from typing import GenericMeta
except ImportError:
    class GenericMeta(type): pass

in gastrodons _init_.py did indeed solved the problem for me (as far as I can tell after using the package for only an hour).

Edit: Just noticed that there is already a Pull Request regarding the issue: #5

om-hb avatar Jul 04 '20 16:07 om-hb