Python, Why do I get ImportError: bad magic number?
Jan 15, 2020
asked by anonymous
Question / Issue:
When I run the following, I get a bad magic number error:
$ python3 manage.py makemigrations
ImportError: bad magic number in 'django.contrib.staticfiles.management': b'\x03\xf3\r\n'
...
How do I fix this?
Responses:
Date: Jan. 15, 2020
Author: Mind Chasers
Comment:
If you are using django or any other Python project from source and have recently updated it (e.g., git pull), then try deleting your binary files (*.pyc):
$ find . -name "*.pyc" | xargs rm