well... you're asking why opening a process in python rather than doing it
directly takes more time. no wonders there: of course it takes more time!
Especially if your process writes lots to stdout/stderr that python needs
to collect.
BTW: never ever ever run ANY external process from the webserver: you could
easily be DDoSed AND you incur in lots of issues (random timeouts, memory
issues, leaks, and aforementioned slowness).
On Thursday, November 17, 2016 at 1:55:28 PM UTC+1, Simon Andersson wrote:
>
> def run():
> import os
> import subprocess
> ex = os.path.join('/home/user', "executable")
>
>
> for i in range(2500):
> a = 1.
> b = 2.
> proc = subprocess.Popen([ex, str(a), str(b),],stdout=subprocess.
> PIPE)
> (out, err) = proc.communicate()
>
>
> redirect(URL('here', args=request.args(0)))
>
> Thanks for the reply. I've written the basic function down. It runs an
> executable 2500 times.
>
> If I run this in a script it takes 5seconds, and if I run this in web2py
> it takes 23 seconds.
>
--
Resources:
- http://web2py.com
- http://web2py.com/book (Documentation)
- http://github.com/web2py/web2py (Source code)
- https://code.google.com/p/web2py/issues/list (Report Issues)
---
You received this message because you are subscribed to the Google Groups
"web2py-users" group.
To unsubscribe from this group and stop receiving emails from it, send an email
to [email protected].
For more options, visit https://groups.google.com/d/optout.