ChadCumba / Online-Behavioral-Experiment

3 stars 0 forks source link

DatabaseError: file is encrypted or is not a database #1

Open twiecki opened 13 years ago

twiecki commented 13 years ago

Hi,

I think it should be set up correctly, but when we access admin/ we get the following error:

Traceback (most recent call last):

File "/usr/lib/pymodules/python2.7/django/core/servers/basehttp.py", line 280, in run self.result = application(self.environ, self.start_response)

File "/usr/lib/pymodules/python2.7/django/core/servers/basehttp.py", line 674, in call return self.application(environ, start_response)

File "/usr/lib/pymodules/python2.7/django/core/handlers/wsgi.py", line 252, in call response = middleware_method(request, response)

File "/usr/lib/pymodules/python2.7/django/contrib/sessions/middleware.py", line 36, in process_response request.session.save()

File "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/db.py", line 56, in save session_key = self.session_key,

File "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/base.py", line 152, in _get_session_key self._session_key = self._get_new_session_key()

File "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/base.py", line 144, in _get_new_session_key if not self.exists(session_key):

File "/usr/lib/pymodules/python2.7/django/contrib/sessions/backends/db.py", line 29, in exists Session.objects.get(session_key=session_key)

File "/usr/lib/pymodules/python2.7/django/db/models/manager.py", line 132, in get return self.get_query_set().get(_args, *_kwargs)

File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 342, in get num = len(clone)

File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 80, in len self._result_cache = list(self.iterator())

File "/usr/lib/pymodules/python2.7/django/db/models/query.py", line 271, in iterator for row in compiler.results_iter():

File "/usr/lib/pymodules/python2.7/django/db/models/sql/compiler.py", line 677, in results_iter for rows in self.execute_sql(MULTI):

File "/usr/lib/pymodules/python2.7/django/db/models/sql/compiler.py", line 732, in execute_sql cursor.execute(sql, params)

File "/usr/lib/pymodules/python2.7/django/db/backends/util.py", line 15, in execute return self.cursor.execute(sql, params)

File "/usr/lib/pymodules/python2.7/django/db/backends/sqlite3/base.py", line 200, in execute return Database.Cursor.execute(self, query, params)

DatabaseError: file is encrypted or is not a database

I made that sure gamesjson.sql is readable/writeable and that sqlite3 could open it (which is what my django uses). This is what sqlite3 gives me:

sqlite3 gamesjson.sql .dump PRAGMA foreign_keys=OFF; BEGIN TRANSACTION; COMMIT;

However, sqlite2 gives:

sqlite gamesjson.sql .dump Unable to open database "gamesjson.sql": file is encrypted or is not a database

Even if I convert the database so that sqlite2 can dump it, the same error message appears. Any ideas?

Thanks, Thomas

ChadCumba commented 13 years ago

Try running python manage.py dbsync (or maybe it's syncdb, I forget which). Either way there's a python command that should be generating that DB automatically for you. If that command gives you an error, it's typically more descriptive than that. Did you generate the DB like that, or did you build it manually?

By the way, I turned on email notifications from my Github, so I'll respond much quicker from now on. I hadn't noticed this until I logged in and saw it on my tracker.