473,289 Members | 1,756 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,289 software developers and data experts.

How to Start a (thread?) and Leave

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

Mar 9 '07 #1
8 1223
probably a Thread.

Mar 9 '07 #2
On Mar 9, 3:25 pm, "abcd" <codecr...@gmail.comwrote:
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

Mar 9 '07 #3
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".

Mar 9 '07 #4
On Mar 9, 3:45 pm, "abcd" <codecr...@gmail.comwrote:
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".

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

Mar 9 '07 #5

<gr********@gmail.comwrote in message
news:11**********************@h3g2000cwc.googlegro ups.com...
| On Mar 9, 3:25 pm, "abcd" <codecr...@gmail.comwrote:
| 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

Mar 9 '07 #6
On Mar 9, 4:57 pm, "Terry Reedy" <tjre...@udel.eduwrote:
<gregpin...@gmail.comwrote in message

news:11**********************@h3g2000cwc.googlegro ups.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.

Mar 9 '07 #7
On Mar 9, 4:57 pm, "Terry Reedy" <tjre...@udel.eduwrote:
<gregpin...@gmail.comwrote in message

news:11**********************@h3g2000cwc.googlegro ups.com...
| On Mar 9, 3:25 pm, "abcd" <codecr...@gmail.comwrote:
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
This will sort of emulate the stop button, that might work:
http://www.thescripts.com/forum/thread601992.html

-Greg

Mar 9 '07 #8
In article <11**********************@8g2000cwh.googlegroups.c om>,
gr********@gmail.com <gr********@gmail.comwrote:
>
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
Mar 14 '07 #9

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

0
by: fowlertrainer | last post by:
Hello ! I have been created a Zope (Python) Product. But it is must store inner global definitions (some conversion parameters), what I need to change in only one thread, or only once. See...
7
by: Morris | last post by:
I want to abort a running thread, so I call MyThread.abort() function. My problem is this thread runs "almost" like a while(true) loop and I don't want the Abort() function interrupts the thread at...
1
by: Novice | last post by:
Hi all, I have written some code that invokes a method a few hundred times and then it immediately finishes. I would like it to instead: 1. start the hundreds of threads (asynchronously) 2....
37
by: ales | last post by:
Hello, I have a problem with creation of new thread. The method .Start() of newly created thread delays current thread for 0 - 1 second. Cpu while delay occurs is about 5%. Any idea? Here...
16
by: pamelafluente | last post by:
I am still working with no success on that client/server problem. I need your help. I will submit simplified versions of my problem so we can see clearly what is going on. My model: A client...
10
by: Doug Robertson | last post by:
First off, I'm a hardware/OS guy. I just write code on the side and I'm completely self taught - so bear in mind my total lack of expertise. I have a program originally written in VB2003 using...
0
by: Yue Fei | last post by:
I have a multi thread python code, threads can start immediately if I run on command line, but I can get them started right the way if I call the same code from C/C++. test code like this: from...
29
by: NvrBst | last post by:
I've read a bit online seeing that two writes are not safe, which I understand, but would 1 thread push()'ing and 1 thread pop()'ing be thread-safe? Basically my situation is the follows: ...
12
by: Ronny | last post by:
Thanks Chris, Looks nice but I miss the dual way communication. In the main thread to deliver paramters and data to the worker thread- how can I do that? Regards Ronny Take a look at the...
0
by: DolphinDB | last post by:
The formulas of 101 quantitative trading alphas used by WorldQuant were presented in the paper 101 Formulaic Alphas. However, some formulas are complex, leading to challenges in calculation. Take...
0
by: DolphinDB | last post by:
Tired of spending countless mintues downsampling your data? Look no further! In this article, you’ll learn how to efficiently downsample 6.48 billion high-frequency records to 61 million...
0
by: Aftab Ahmad | last post by:
Hello Experts! I have written a code in MS Access for a cmd called "WhatsApp Message" to open WhatsApp using that very code but the problem is that it gives a popup message everytime I clicked on...
0
by: Aftab Ahmad | last post by:
So, I have written a code for a cmd called "Send WhatsApp Message" to open and send WhatsApp messaage. The code is given below. Dim IE As Object Set IE =...
0
by: ryjfgjl | last post by:
ExcelToDatabase: batch import excel into database automatically...
0
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
1
isladogs
by: isladogs | last post by:
The next Access Europe meeting will be on Wednesday 6 Mar 2024 starting at 18:00 UK time (6PM UTC) and finishing at about 19:15 (7.15PM). In this month's session, we are pleased to welcome back...
0
by: Vimpel783 | last post by:
Hello! Guys, I found this code on the Internet, but I need to modify it a little. It works well, the problem is this: Data is sent from only one cell, in this case B5, but it is necessary that data...
1
by: PapaRatzi | last post by:
Hello, I am teaching myself MS Access forms design and Visual Basic. I've created a table to capture a list of Top 30 singles and forms to capture new entries. The final step is a form (unbound)...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.