[QGIS-Developer] [processing] launching separate process/thread
Andreas Plesch
andreasplesch at gmail.com
Sun May 21 05:17:58 PDT 2017
As a followup, here is the simple processing script which is my attempt at
launching a separate task:
https://github.com/andreasplesch/QGIS-X3D-Processing/blob/master/scripts/launch_webserver.py
qgis2web does not seem to need a real http server for the preview as
openlayers apparently can use the file protocol.
-Andreas
On Sat, May 20, 2017 at 5:29 PM, Andreas Plesch <andreasplesch at gmail.com>
wrote:
> I would like to launch a minimal web server from a processing script to
> serve html properly (rather than using the file protocol).
>
> Since the web server needs to run and keep running separately from qgis or
> the qgis python interpreter, I investigated various ways to accomplish this
> using SimpleHTTPServer. On windows 2.18.7 as linux should be more robust.
>
> - threading.Threat : start() works until the server actually serves a
> file. Then qgis crashes with a minidump . For some reason, the crashing
> happens not always but more often than not.
> - multiprocessing : seems to be the recommended solution but I do not seem
> to have it with Qgis python (?)
> - QProcess.start() : works from the python terminal, seems robust but does
> not seem to work from a processing script (?). Would be the preferred
> solution.
> - QProcess.startDetached('python',(args),dir) : works reliably but
> requires killing and restarting the process to change the root directory
> served
>
> This may all change with Qgis 3 but I suspect 2.18 will be around for a
> while, too.
>
> Any recommendations or ideas would be welcome.
>
> I will look into qgis2web to see what it does.
>
> --
> Andreas Plesch
> 39 Barbara Rd.
> Waltham, MA 02453
>
--
Andreas Plesch
39 Barbara Rd.
Waltham, MA 02453
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://lists.osgeo.org/pipermail/qgis-developer/attachments/20170521/466d2936/attachment.html>
More information about the QGIS-Developer
mailing list