bionlplab / bioc

Data structures and code to read/write BioC XML and Json.
MIT License
29 stars 11 forks source link

syntax error in import bioc #7

Closed kmurphy902 closed 5 years ago

kmurphy902 commented 5 years ago

Hi,

I am attempting to use BioC on MacOS X and when I try to import bioc in Python 2.7.10 I get the following error:

>>> import bioc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
  File "/Library/Python/2.7/site-packages/bioc/__init__.py", line 4, in <module>
    from .bioc import BioCCollection, BioCDocument, BioCPassage, BioCSentence, BioCAnnotation, \
  File "/Library/Python/2.7/site-packages/bioc/bioc.py", line 24
    def __init__(self, refid: str, role: str):
                            ^
SyntaxError: invalid syntax

I have updated to the most recent version:

sudo pip install bioc
Password:
Requirement already satisfied: bioc in /Library/Python/2.7/site-packages (1.3.1)
Requirement already satisfied: docutils==0.14 in ./Library/Python/2.7/lib/python/site-packages (from bioc) (0.14)
Requirement already satisfied: lxml==4.2.5 in /Library/Python/2.7/site-packages (from bioc) (4.2.5)
Requirement already satisfied: jsonlines==1.2.0 in /Library/Python/2.7/site-packages (from bioc) (1.2.0)
Requirement already satisfied: six in ./Library/Python/2.7/lib/python/site-packages (from jsonlines==1.2.0->bioc) (1.11.0)

Thank you in advance for your help! Karyn

jakelever commented 5 years ago

Hey @yfpeng , I hope you're well. This issue popped up in the Kindred project. It looks like some of the code from v1.2.4 onwards is not Python 2 compatible. Are you planning on this library being Py3 only from now on? Just need to know for planning for Kindred.

Relevant Kindred issue: https://github.com/jakelever/kindred/issues/8

yfpeng commented 5 years ago

bioc supports py>=3.6 since version 1.2.1. You can use v1.2 which supports both py2 and py3.

jakelever commented 5 years ago

Cool. Thanks for the quick answer.

kmurphy902 commented 5 years ago

Thanks!

kaushikacharya commented 5 years ago

bioc supports py>=3.6 since version 1.2.1. You can use v1.2 which supports both py2 and py3. @yfpeng pip install bioc==1.2 throws the following error:

Could not find a version that satisfies the requirement bioc==1.2 (from versio ns: 1.0.dev22, 1.0.dev23, 1.0.dev24, 1.0.dev25, 1.0.dev27, 1.0.dev28, 1.0.dev29, 1.0.dev30, 1.0.dev31, 1.0.dev32, 1.0, 1.1.dev1, 1.1.dev2, 1.1.dev3, 1.2.3, 1.2. 4, 1.3, 1.3.1) No matching distribution found for bioc==1.2

Even in your NegBio code for Python 2.7, you are using bioc==1.1.dev3

yfpeng commented 5 years ago

@kaushikacharya It seems v1.2 is in the repository. https://pypi.org/project/bioc/#history