Greko2015 GuFn
Greko2015 GuFn

Reputation: 589

Django "ValueError: source code string cannot contain null bytes"

I am facing this error:

ValueError: source code string cannot contain null bytes

whenever I create a splite3 database and use it.

Below are the steps i follow:

  1. Create the database using db browser.
  2. Run python manage.py inspectdb > customer.py
  3. Run the server with python manage.py runserver

I get this error when I run the server. Could someone please help me with this?

Upvotes: 2

Views: 951

Answers (2)

Guilherme Garcia
Guilherme Garcia

Reputation: 115

This could be an encoding error. You can try this:

  1. Copy the code generated by inspectdb (Ex: models.py)
  2. Open a text editor or notepad (select UTF-8)
  3. Save the file
  4. Replace the old file with this new one

Upvotes: 0

Eivar Morales
Eivar Morales

Reputation: 49

open the file in IDLE or notepad and save it again with UTF-16 Encoding

Upvotes: 1

Related Questions