Question

I've updated cygwin and python on cygwin to 2.7 and now I cannot load any json files to the database using the loaddata management command in Django. (Using SQLite3 as a database backend)

It works for a fixture that has only one instance of data. If there are two or more it fails on the second one like this:

DatabaseError: Problem installing fixture 'myapp/fixtures/initial_data.json': Could not load myapp.MyModel(pk=2): unable
to open database file

Does anyone else have this problem?

Some extra info: I have tried this on a fresh installation of cygwin on a second computer, and I have tried it on several of my django projects. It's the same error everywhere.

I'm pretty sure anyone could recreate this error just by trying the loaddata command on the newest version of cygwin.

Edit:

it works for this json file:

[
{
    "pk": 1, 
    "model": "myapp.mymodel", 
    "fields": {
        "title": "Some title"
    }
}]

But fails for this one:

[
{
    "pk": 1, 
    "model": "myapp.mymodel", 
    "fields": {
        "title": "Some title"
    }
},
{
    "pk": 2, 
    "model": "myapp.mymodel", 
    "fields": {
        "title": "Some other title"
    }
}]
Was it helpful?

Solution

after a lot of testing with the cygwin installer I figured out the solution to the problem:

I uninstalled libsqlite3 and sqlite3 3.7.16 and installed the sqlite3 and libsqlite3 3.7.13 version instead. Now it works!

OTHER TIPS

I had the same issue and fixed it by upgrading from version 3.7.16 to version 3.8.2.

In other words: Downgrading isn't the only solution, upgrading works too! It's version 3.7.16 specifically that appears to be the problem.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top