How to Start a (thread?) and Leave

G

gregpinero

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
 
G

gregpinero

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
 
A

abcd

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".
 
G

gregpinero

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".


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
 
T

Terry Reedy

| > 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.

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
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

No members online now.

Forum statistics

Threads
473,774
Messages
2,569,599
Members
45,175
Latest member
Vinay Kumar_ Nevatia
Top