Google Groups no longer supports new Usenet posts or subscriptions. Historical content remains viewable.
Dismiss

How to Start a (thread?) and Leave

0 views
Skip to first unread message

gregp...@gmail.com

unread,
Mar 9, 2007, 3:22:02 PM3/9/07
to
Here's my situation, would you folks be so kind as to reccomend an
approach?

I have a small Python CGI script running as an intranet app. One of
the things the script needs to do is allow users to save invoices.
This is a process that takes about 60 seconds once the user submits
the order from the web app.

Ideally I'd like the CGI script to kick off a process to save the
invoice but not wait until it's finished to render the page. What's
the best way to do this, a thread, call a separate program from
os.system, something else?

Thanks in advance for the help.

-Greg

abcd

unread,
Mar 9, 2007, 3:25:26 PM3/9/07
to
probably a Thread.

gregp...@gmail.com

unread,
Mar 9, 2007, 3:30:26 PM3/9/07
to
On Mar 9, 3:25 pm, "abcd" <codecr...@gmail.com> wrote:
> probably a Thread.


But a thread leaves the script running until the thread exits, right?
So the webpage would just keep saying "loading" at the bottom I think.

-Greg

abcd

unread,
Mar 9, 2007, 3:45:54 PM3/9/07
to
> But a thread leaves the script running until the thread exits, right?
> So the webpage would just keep saying "loading" at the bottom I think.
>
> -Greg

give it a shot. if you spawn off a new thread your code should keep
executing while the thread does its work in the "background".

gregp...@gmail.com

unread,
Mar 9, 2007, 3:57:25 PM3/9/07
to


That's the thing though, I don't want my code to keep executing, I
want the script to exit/finish completely.

I'm leaning towards os.startfile right now. I also see some os.spawn
beasties in there but I don't understand those.

-Greg

Terry Reedy

unread,
Mar 9, 2007, 4:57:51 PM3/9/07
to pytho...@python.org

<gregp...@gmail.com> wrote in message
news:1173472226.6...@h3g2000cwc.googlegroups.com...

Can you tell the page to auto-refresh itself every 15 seconds or so? I
have seen this as a user but don't know if it is special html code or
javascript or java or what.

tjr

gregp...@gmail.com

unread,
Mar 9, 2007, 5:59:44 PM3/9/07
to
On Mar 9, 4:57 pm, "Terry Reedy" <tjre...@udel.edu> wrote:
> <gregpin...@gmail.com> wrote in message
>
> news:1173472226.6...@h3g2000cwc.googlegroups.com...

> Can you tell the page to auto-refresh itself every 15 seconds or so? I


> have seen this as a user but don't know if it is special html code or
> javascript or java or what.
>
> tjr

That's a good point. I'll check into that. If not it looks like I'll
be going with os.spawn.

gregp...@gmail.com

unread,
Mar 9, 2007, 6:07:58 PM3/9/07
to
On Mar 9, 4:57 pm, "Terry Reedy" <tjre...@udel.edu> wrote:
> <gregpin...@gmail.com> wrote in message

This will sort of emulate the stop button, that might work:
http://www.thescripts.com/forum/thread601992.html

-Greg

Aahz

unread,
Mar 14, 2007, 5:21:05 PM3/14/07
to
In article <1173473845.5...@8g2000cwh.googlegroups.com>,

gregp...@gmail.com <gregp...@gmail.com> wrote:
>
>I'm leaning towards os.startfile right now. I also see some os.spawn
>beasties in there but I don't understand those.

Try the subprocess module
--
Aahz (aa...@pythoncraft.com) <*> http://www.pythoncraft.com/

"I disrespectfully agree." --SJM

0 new messages