0

In my python project I've been added :

from tethne.model.corpus import mallet

but my problem is that when I'm running my project I see these errors in my pycharm console:

  Traceback (most recent call last):
  File "D:/Python-Workspace(s)/BehnazDemo/Demo.py", line 1, in <module>
    from tethne.model.corpus import mallet
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\tethne-0.8-py3.5.egg\tethne\__init__.py", line 20, in <module>
    from tethne.classes.paper import Paper
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\tethne-0.8-py3.5.egg\tethne\classes\paper.py", line 5, in <module>
    from tethne.classes.feature import Feature, feature
  File "C:\Users\Administrator\AppData\Local\Programs\Python\Python35-32\lib\site-packages\tethne-0.8-py3.5.egg\tethne\classes\feature.py", line 20, in <module>
    from itertools import chain, izip
ImportError: cannot import name 'izip'

How can I solve this issue?

Thanks.

brelian
  • 403
  • 2
  • 15
  • 31

1 Answers1

0

It seems you're using Python3.x, so the code should be:

try:
    from itertools import izip as zip 
except ImportError: # Python3.x you can just use zip
    pass

Or:

from itertools import zip_longest

Python 3 does not have izip in itertools, but the built-in zip does the same job as izip in Python2.x.

SiHa
  • 7,830
  • 13
  • 34
  • 43
McGrady
  • 10,869
  • 13
  • 47
  • 69
  • I've been used python 3.5 and I also added zip_longest based on your solutions and used try - except but after running again I saw same error that I've been added in my question. Can you help me, more? – brelian Mar 24 '17 at 17:10
  • @SiHa : I've been used python 3.5 and I also added zip_longest based on your solutions and used try - except but after running again I saw same error that I've been added in my question. Can you help me, more? – brelian Mar 24 '17 at 17:10
  • @brelian You should remove `izip` from the line `from itertools import chain, izip`.By the way,you can also add a issue on Github [tethne](https://github.com/diging/tethne) for more support. – McGrady Mar 25 '17 at 02:03