khurniawan eko
khurniawan eko

Reputation: 11

Cannot import Owlready library into Python

I am a beginner in Python. I am working on an ontology using owlready. I've installed owlready library on my PyCharm IDE, but there is an issue with importing owlready in my python code. I've tried from owlready import * just like in the documentation, but it always give me:

Traceback (most recent call last):
  File "C:/Users/siekoo/OneDrive/Development/python/NER/onto_start.py", line 1, in <module>
    from owlready import *
  File "C:\winpython\python-2.7.10.amd64\lib\site-packages\owlready\__init__.py", line 85
    def __init__(self, *Entities, ontology = None):
                                         ^
SyntaxError: invalid syntax

Upvotes: 1

Views: 645

Answers (1)

tayfun
tayfun

Reputation: 3135

It looks like Owlready is for Python 3 while you're using Python 2. Change your python version for it to work.

The invalid syntax error is because of the new Python 3 argument lists, see: https://docs.python.org/3/tutorial/controlflow.html#arbitrary-argument-lists

Upvotes: 2

Related Questions