RuntimeError: Bad magic number in .pyc file

Bug #404824 reported by Sergey "Shnatsel" Davidoff
10
This bug affects 2 people
Affects Status Importance Assigned to Milestone
Wikipedia Dump Reader
Fix Committed
Undecided
Unassigned

Bug Description

When I launch the program, it prints "RuntimeError: Bad magic number in .pyc file" and quits. Other Python apps work correctly (e.g. Minirok). Tested on Ubuntu Jaunty.

Tags: python runtime
Revision history for this message
Benjamin Thyreau (benji2) wrote :

Hi,
Thanks for your report.
This sounds like a runtime compatibility problem.
Can you tell me how you installed the program (package, kde-apps, bzr branch, etc.) ?

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

I've downloaded the 0.2.9 deb package from Launchpad. It didn't work, so I tried 0.2.8 and got the same result. By the way, the package didn't appear in Synaptic. I tried apt-get update, but that didn't help. I'm not sure if it is a bug, though.

Revision history for this message
Benjamin Thyreau (benji2) wrote :

Thanks for your prompt reply.
This is a "binary" incompatibility between python 2.5 and 2.6 (default in Jaunty).
There is two quick workaround:
- If you have python2.5 and root write access, editing the file /usr/bin/wikipediaDumpReader , changing "python" to "python2.5" (at characted 98) should be enough.
- using the .tar.gz package instead of the .deb should also work, as it doesn't "precompile" any binary "pyc" files.

I don't know if python 2.5 is available in Jaunty in default install. If so, the first fix is the best IMHO. Otherwise, i will need to build a new package with 2.6 "binaries" (pyc files), but as packaging python programs in Ubuntu is such a pain, i will do that later, and let user relies on the .tar.gz package instead

Please let me know if you achieve to make it work with one of the above-mentioned recipe

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

Editing /usr/bin/wikipediaDumpReader solved everything. Thanks for such a quick answer!

Changed in wikipediadumpreader:
status: New → In Progress
Revision history for this message
Benjamin Thyreau (benji2) wrote :

I just uploaded a new "ubuntu" package with no pyc-files. This one should work on any Python version, and should have negligible starting slowdown as the source code is so short.

May you have time to test it ? It should fixes all the issues, and is available.
http://launchpad.net/wikipediadumpreader/trunk/0.2.9/+download/wikipediaDumpReader-i386-0.2.9j.deb

It also fixes a window-manager glitch regarding the "close" button on Jaunty Qt.

Unless there is a major problem (something not working or performance issue), i will set it as prefered download.

Also, WikipediaDumpReader is not in the official repositories AFAIK. Don't know what i should do for that :-)

Revision history for this message
Sergey "Shnatsel" Davidoff (shnatsel) wrote :

Somebody already requested including WikipediaDumpReader in the official universe repository, see bug #149878. I'll test this new version as soon as I can. It at least starts.

Revision history for this message
Benjamin Thyreau (benji2) wrote :

Thanks for testing. Getting the program to start correctly is sufficient, as the fix above only relates to that.

I wasn't aware of "bug" 149878. Yet it is two years, and i'm not sure how exactly posting those has any effect on anything :-)

Anyway, thanks for your reactive help !

Changed in wikipediadumpreader:
status: In Progress → Fix Committed
Revision history for this message
Kaan (kaanunal1996) wrote :

I have a serious problem. Me and my friend spent months to solve this problem but we couldn`t fix that. We were Playing online game but when i format my computer and redownload the game it says - TraceBack Error : Bad Magic Number in Program Files...
if anyone can help us please send me an e-mail. Thank you all.

To post a comment you must log in.
This report contains Public information  
Everyone can see this information.

Other bug subscribers

Remote bug watches

Bug watches keep track of this bug in other bug trackers.