Ok, it seems that the problem is not exactly what it seemed in the
beginning. Namely: the process is created and works fine, _but_ the
django still hangs on returning the http response.

In other words (OS = Linux):

views.py:

def test(request):
   FNULL = open('/dev/null', 'w')
   Popen(["test.py", "20"], stdout=FNULL, stderr=FNULL)
   print "after function call"
   return HttpResponseRedirect("/somewhere")

test.py:

import time
print "==="
time.sleep(20)
print "==="

Now the problem is that although this structure does work (e.g. I do
see "after function call" right away), but the actual redirect is
issued only after the specified time is slept (20sec in this case).
Might it be something related with the input/output? I tried defining /
dev/null as a direction for the child process but that didn't help at
all.

Any idea would be highly appreciated!

thanks,
Ilja

On May 9, 12:49 am, "Austin Bingham" <[EMAIL PROTECTED]> wrote:
> Sorry for kinda jumping in the middle here, but have you tried
> fork/exec? It's odd that spawn with NOWAIT isn't giving you what you
> want, and I'm curious as to whether you can provide more details. In
> any event, though, fork/exec is a somewhat more verbose way of getting
> basically the same result. Good luck :)
>
> Austin
>
> > > On 5/8/07, [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote:
>
> > > > I've spent quite a lot of time trying to simply spawn a new process
> > > > (by spawn I mean os.P_NOWAIT). The problem is that I cannot manage to
> > > > get django not to halt after the execution of the process spawning
> > > > command (the idea is that in views I want to start a background
> > > > process that is quite time intense).
>
> > > > I've tried os.spawnl and subprocces.Popen, neither work. Or I'm just
> > > > too n00b in Python and Django to understand how they should be
> > > > handled. Perhaps anybody could help me? Pleease?
>
> > > > Thanks,
> > > > Ilja


--~--~---------~--~----~------------~-------~--~----~
You received this message because you are subscribed to the Google Groups 
"Django users" group.
To post to this group, send email to django-users@googlegroups.com
To unsubscribe from this group, send email to [EMAIL PROTECTED]
For more options, visit this group at 
http://groups.google.com/group/django-users?hl=en
-~----------~----~----~----~------~----~------~--~---

Reply via email to