librelist archives

« back to archive

Configurable interpreter for reload functionality

Configurable interpreter for reload functionality

From:
Baiju M
Date:
2011-03-06 @ 17:00
Hi All,

I was trying to use Buildout for developing application with Flask.
It doesn't work if I set debug=True option

It looks like the functionality is part of Werkzeug:

------x<------- File: werkzeug/serving.py --------x<-------------
...
def restart_with_reloader():
    """Spawn a new Python interpreter with the same arguments as this one,
    but running the reloader thread.
    """
    while 1:
        _log('info', ' * Restarting with reloader: %s', reloader_name)
        args = [sys.executable] + sys.argv
...

------x<------- File: werkzeug/serving.py --------x<-------------

The interpreter path is hard-coded as 'sys.executable'. This will not work
if somebody use custom interpreter created using 'cmd' module.
This is the situation with Buildout when we enable debug mode.

Is it possible to make interpreter configurable ?

Regards,
Baiju M

Re: [flask] Configurable interpreter for reload functionality

From:
Simon Sapin
Date:
2011-03-07 @ 00:59
Le 07/03/2011 02:00, Baiju M a écrit :
> The interpreter path is hard-coded as 'sys.executable'. This will not work
> if somebody use custom interpreter created using 'cmd' module.
> This is the situation with Buildout when we enable debug mode.
>
> Is it possible to make interpreter configurable ?

Hi,

I guess the "least worst" solution right now is monkey-patching the 
module with your version of this function.

Regards,
-- 
Simon Sapin
http://exyr.org/