machinalis / iepy

Information Extraction in Python
BSD 3-Clause "New" or "Revised" License
906 stars 186 forks source link

django.db.utils.OperationalError: unable to open database file #96

Closed birdmw closed 8 years ago

birdmw commented 8 years ago

Vanilla iepy, was working fine but now I am getting a db access error.

godfather.csv is from the example.

traceback:

@#####-thinkpad:~/Desktop/nlp/ie_project$ sudo python3 bin/csv_to_iepy.py godfather.csv

Importing Documents to IEPY from godfather.csv Traceback (most recent call last): File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 133, in ensure_connection self.connect() File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 122, in connect self.connection = self.get_new_connection(conn_params) File "/usr/local/lib/python3.4/dist-packages/django/db/backends/sqlite3/base.py", line 374, in get_new_connection conn = Database.connect(**conn_params) sqlite3.OperationalError: unable to open database file

The above exception was the direct cause of the following exception:

Traceback (most recent call last): File "bin/csv_to_iepy.py", line 28, in csv_to_iepy(filepath) File "/usr/local/lib/python3.4/dist-packages/iepy/utils.py", line 133, in csv_to_iepy update_mode=True File "/usr/local/lib/python3.4/dist-packages/iepy/data/db.py", line 64, in create_document if not filter_query.exists(): File "/usr/local/lib/python3.4/dist-packages/django/db/models/query.py", line 606, in exists return self.query.has_results(using=self.db) File "/usr/local/lib/python3.4/dist-packages/django/db/models/sql/query.py", line 457, in has_results return compiler.has_results() File "/usr/local/lib/python3.4/dist-packages/django/db/models/sql/compiler.py", line 757, in has_results return bool(self.execute_sql(SINGLE)) File "/usr/local/lib/python3.4/dist-packages/django/db/models/sql/compiler.py", line 784, in execute_sql cursor = self.connection.cursor() File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 165, in cursor cursor = self.make_debug_cursor(self._cursor()) File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 138, in _cursor self.ensure_connection() File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 133, in ensure_connection self.connect() File "/usr/local/lib/python3.4/dist-packages/django/db/utils.py", line 94, in exit six.reraise(dj_exc_type, dj_exc_value, traceback) File "/usr/local/lib/python3.4/dist-packages/django/utils/six.py", line 658, in reraise raise value.with_traceback(tb) File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 133, in ensure_connection self.connect() File "/usr/local/lib/python3.4/dist-packages/django/db/backends/init.py", line 122, in connect self.connection = self.get_new_connection(conn_params) File "/usr/local/lib/python3.4/dist-packages/django/db/backends/sqlite3/base.py", line 374, in get_new_connection conn = Database.connect(**conn_params) django.db.utils.OperationalError: unable to open database file

birdmw commented 8 years ago

It was just a java issue

jmansilla commented 8 years ago

Thanks Matthew for the auto-close.

Can you provide a little more info, just in case it's useful for someone else in the future?

birdmw commented 8 years ago

Sure, so there are a couple unintuitive things that people can (and I have seen) get caught on, one is the use of pip3 vs pip, and the use of python3 vs python. For many, we will need to use pip3. With the Java issue, I had to $export JAVAHOME=/path/to/java (the file, not the directory). And finally, if you run into more permissions problems, make sure you actually cd into the django project you created.