BOMBOLOM.COM

(python) ImportError: Bad magic number

Posted by José Lopes.

How to fix an error like:

ImportError: Bad magic number in ../SOME_FILE.pyc

This kind of error is associated with the pyc file type. The solution is simple: delete all the existing files with this extension and run your scripts again.

It may seem a radical solution but it may spare you some time because many or all the files are affected. Nevertheless these files are re-created once you run your program.

The error happens when we are using different Python versions, either between users or after an upgrade.

This type of file stores a "magic number" that is specific for each Python release. Each time the file is called a verification is done to match the it the expected value.

For further information about the existence of this number you may check the source code at Python/import.c.

2008.01.09 | There's more... | Comments 0 | Tags ,

Deixe a sua mensagem:

Nome:


E-mail:


URL:


Comment:

Secret number

To send you comment you must insert the "secret number" on the box


Made with PyBlosxom | Add to Google