On 6/15/24 03:10, via Mailman-users wrote:
Now, obviously, I put these exact lines in a script, so I don't have to type it out every single time, and try to run it using
sudo -u list mailman shell -l testlist.our-server.de -r ./mm_discard_held.py
but that invariably gives me
...
TypeError: the 'package' argument is required to perform a relative import for './mm_discard_held'
To run a script named mm_discard_held.py in that way, the script must define a function mm_discard held. The content needs to be something like
from mailman.app.moderator import handle_message
from mailman.config import config
from mailman.interfaces.action import Action
from mailman.interfaces.request import IListRequests
# The above are needed. These imports are done automatically when
# running mailman shell interactively, but not when running a script.
def mm_discard_held(mlist)
rdb = IListRequests(mlist)
for req in rdb.held_requests:
if req.request_type == RequestType.held_message:
config.db.commit()
See mailman shell --details
I've tried moving it to the path where the mailman binary lives, as suggested.
That is what you should do.
-- Mark Sapiro <mark@msapiro.net> The highway is for gamblers, San Francisco Bay Area, California better use your sense - B. Dylan