Refreshing Python filters?

David Hláčik david at
Sun Jun 8 12:02:51 UTC 2008

Hello Julien , thank you for you effort anyway. I am getting closer
and i am restarting innd every time i made a change to my python
Let me please answer last question , i actually need to have finished
that whole access and authentication think until tommorow for company
i am working :
my python authentication works fine.
i have problem with python access , let me describe it closer.
As i know from documentation module access should return directory
with read and post keys and as a value it should contain newsgroups .
When my access module returns : {'read':'*','post':'*'} , it works
just fine and i am getting access to all newsgroups, but when my
access module returns :
{'read':'local.sandbox,'write':'local.sandbox'} i will get an error in
client Windows Mail and all others too (no in news.notice logs) that
client was unable to retrieve list of newsgroups available on server
with error string : ====BACKTRACE======

Thank you!

On Sun, Jun 8, 2008 at 1:10 PM, Julien ÉLIE <julien at> wrote:
> Hi,
>> I have just tried to play with but I have an issue with
>> applying the changes done in this file when reloading it.
>> Is there a special thing to do in order to correctly reload a Python
>> filter?
>> In fact, I cannot reload it without *stopping* and *restarting* INN!
>> I reckon it is a bug...
> Oh, reading Python API on reloading:
>   Reload a previously imported module.  The argument must be a module
> object,
>   so it must have been successfully imported before.
>   [...]
>   There are a number of other caveats:
>   If a module is syntactically correct but its initialization fails, the
> first
>   import statement for it does not bind its name locally, but does store a
>   (partially initialized) module object in sys.modules. To reload the module
>   you must first import it again (this will bind the name to the partially
>   initialized module object) before you can reload() it.
> I do not understand well what Python exactly does.
> What is partially initialized?  "dir(filter_innd)" does not seem to change.
> However, what I see is that reloading properly works if I import the Python
> module again before reloading it:
> Index: innd/python.c
> ===================================================================
> --- innd/python.c       (révision 7859)
> +++ innd/python.c       (copie de travail)
> @@ -601,6 +601,7 @@
>       Py_XDECREF(result);
>    }
> +    PYsetup();
>    if ((newmodule = PyImport_ReloadModule(PYFilterModule)) == NULL) {
>       syslog(L_ERROR, "cant reload python filter module");
>       PYfilter(false);
> Maybe PYsetup() is too much and only a
>   PyImport_ImportModule((char *) INN_PATH_PYTHON_STARTUP_M);
> is enough but I do not know whether everything is properly initialized
> by Python afterwards...
> --
> Julien ÉLIE
> « Dans l'algèbre comme dans la police, il faut identifier X. » (André
> Frédérique)

More information about the inn-workers mailing list