FS#12004 - __init__.pyc still left in python2.5 dir, while pyqt is using python2.6 now (bad magic number error)

Attached to Project: Arch Linux
Opened by Johannes Dewender (JonnyJD) - Wednesday, 05 November 2008, 17:34 GMT
Last edited by Allan McRae (Allan) - Tuesday, 18 November 2008, 04:07 GMT
Task Type Bug Report
Category Packages: Extra
Status Closed
Assigned To Douglas Soares de Andrade (dsa)
Allan McRae (Allan)
Architecture All
Severity Low
Priority Normal
Reported Version None
Due in Version Undecided
Due Date Undecided
Percent Complete 100%
Votes 0
Private No


pyqt-4.4.3-2 is using the site-package directory /usr/lib/python2.6/site-packages
in /usr/lib/python2.6/site-packages/PyQt4 is a compiled __init__.pyc left from the old version, which is not deleted.
This leads to this type of error in packages depending on pyqt:

Traceback (most recent call last):
File "/usr/bin/picard", line 2, in <module>
from picard.tagger import main; main('/usr/share/locale', True)
File "/usr/lib/python2.6/site-packages/picard/tagger.py", line 21, in <module>
from PyQt4 import QtGui, QtCore
ImportError: Bad magic number in /usr/lib/python2.5/site-packages/PyQt4/__init__.pyc

This is also reported for other programs in

Additional info:

Steps to reproduce:
Install a version of pyqt using python2.5 (pyqt-4.4.3-1 works) and python 2.5. Open the program using pyqt, so it compiles to a .pyc
Update pyqt.
Now you have the __init__.pyc still in the old directory and the wrong PyQt4 is loaded.

The fix would be to delete the .pyc while upgrading pyQt. I have no clue how/if this is done in other packages, but other packages might also be affected.
This task depends upon

Closed by  Allan McRae (Allan)
Tuesday, 18 November 2008, 04:07 GMT
Reason for closing:  Deferred
Comment by Allan McRae (Allan) - Saturday, 08 November 2008, 20:45 GMT
This is not the only package leaving such a file behind. Maybe we need to get a better python packaging policy to deal with this problem.
Comment by Allan McRae (Allan) - Tuesday, 18 November 2008, 04:07 GMT
I am going to close this as deleting the file is a simple solution for the meantime. I am working on a python packaging policy that will address these issues.