Bad magic number - yummain.pyc

Greg Hamilton yellowdog-general@lists.terrasoftsolutions.com
Wed Oct 29 18:18:01 2003


yummain.pyc is compiled Python byte code. I think the 'Bad magic 
number' error is caused by trying to import the Python file using a 
different version of Python to the one which compiled the file 
originally. Perhaps you've installed a new version of Python.

My /usr/share/yum directory contains only .pyc files and not the 
original .py source files but I'm sure you could get the source files, 
probably from the YDL site. You can generate new .pyc files from the 
source.

The yum source may be setup to install with the Python distutils 
package in which case just follow the install instructions.  If not 
then delete the .pyc files and copy the .py files into /usr/share/yum. 
Next time you run yum Python will automatically compile the .py files 
to .pyc. (you will need to run yum as a user who can write to 
/usr/share/yum - eg. root)

Greg


On 30/10/2003, at 11:43 AM, John Kebbel wrote:

> When I tried running YUM with anything, I got this message.Can anyone
> suggest a fix for this? I've tried as me, as me with sudo, and as root.
> Same error.
>
> [kebbelj@localhost kebbelj]$ yum install libstdc++devel
> Traceback (most recent call last):
> File "/usr/bin/yum", line 22, in ?
> import yummain
> ImportError: Bad magic number in /usr/share/yum/yummain.pyc
>
>
> _______________________________________________
> yellowdog-general mailing list
> yellowdog-general@lists.terrasoftsolutions.com
> http://lists.terrasoftsolutions.com/mailman/listinfo/yellowdog-general
>