[Mailman-Users] .py and .pyc files
Mark Sapiro
mark at msapiro.net
Wed May 4 19:55:42 CEST 2011
LuKreme wrote:
>I made some changes to a .py file and then restarted mailman with
>
>/usr/local/mailman/bin/mailmanctl restart
>
>however, the .pyc file did not get updated as its timestamp didn't change:
>
># ls -lshtr Mailman/Handlers/Spam*
> 6 -rw-r--r-- 1 root mailman 4.4K Apr 24 2010 Mailman/Handlers/SpamDetect.pyc
> 6 -rw-r--r-- 1 root mailman 4.9K May 4 08:58 Mailman/Handlers/SpamDetect.py
>
>the change was simple, just added some text to the Errors.RejectMessage
>
>(Mailman-2.1.12)
>
>So, it looks like mm_cfg.py is the only .py that gets recompiled automatically, right? So how do I recompile SpamDetect.py after making my changes?
When Python imports a module and the module's .py file is newer than
the .pyc, it will read the .py, compile it and if it can, write the
.pyc.
The problem here is permissions. By the time the qrunners are importing
anything, they are running as user:group mailman:mailman, and neither
the user nor the group has permission to write
Mailman/Handlers/SpamDetect.pyc. This is OK in general, but will lead
to your particular issue. If you
chown mailman Mailman/Handlers/SpamDetect.pyc
(or maybe even 'chown -R mailman Mailman'), and then restart Mailman,
SpamDetect.pyc will be updated.
--
Mark Sapiro <mark at msapiro.net> The highway is for gamblers,
San Francisco Bay Area, California better use your sense - B. Dylan
More information about the Mailman-Users
mailing list