bionlplab / bioc

Data structures and code to read/write BioC XML and Json.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

syntax error in import bioc

kmurphy902 opened this issue · comments

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

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: jakelever/kindred#8

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

Cool. Thanks for the quick answer.

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