473,289 Members | 1,829 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.

[win32] spawn background process and detach it w/o problems

Hello!
How to write portable (win32, unix) script that launches another
program and continues its execution?

I've looked at spawn*() but it doesn't look in PATH dirs on windows so
it's totally unusable when you don't know where exactly program is.

I've looked at fork() way but there's no fork for windows.

My current solution is
thread.start_new(os.system, (<here's program to launch>,))

It's ugly and there's one big unpleasant pecularity:
in case there were any os.chdir()-s between beginning of script
execution and that thread.start_new() then new thread starts in
original directory. Not in current directory at moment of
thread.start_new()
Nov 8 '07 #1
2 3399
On Nov 8, 8:09 am, "Dmitry Teslenko" <dtesle...@gmail.comwrote:
Hello!
How to write portable (win32, unix) script that launches another
program and continues its execution?

I've looked at spawn*() but it doesn't look in PATH dirs on windows so
it's totally unusable when you don't know where exactly program is.

I've looked at fork() way but there's no fork for windows.

My current solution is
thread.start_new(os.system, (<here's program to launch>,))

It's ugly and there's one big unpleasant pecularity:
in case there were any os.chdir()-s between beginning of script
execution and that thread.start_new() then new thread starts in
original directory. Not in current directory at moment of
thread.start_new()
Take a look at the subprocess module.

Nov 8 '07 #2
Hello!

On 08/11/2007, da*********@gmail.com <da*********@gmail.comwrote:
Take a look at the subprocess module.
Big thanks!

It's interesting what's happening with subprocess.Popen instance after
it has been instatiated and script's main thread exits leaving
Popen'ed application open.
Nov 9 '07 #3

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

Similar topics

1
by: googlemike | last post by:
I'm trying to use Python and PyGTK + Glade, along with Bash. I want to make a GUI for the Linux vpnclient command-line tool. (Look for linux-vpnclient.tar.gz on the Internet if you are curious.)...
2
by: RL | last post by:
Hello Perl gurus, 1. I have a web page where I can push a button (dospawn.html). 2. This button calls a CGI script (spawnboss.cgi) 3. spawnboss.cgi calls a forking perl script (forkme.pl) 4....
0
by: rtm | last post by:
I am interested in running a process with a timeout. Also I'm interested in analyzing the output of this process. Under Unix, the solution is described clearly in the Perl Cookbook "16.10: ...
8
by: Harlin Seritt | last post by:
I have a remote linux server where I can only access it via ssh. I have a script that I need to have run all the time. I run like so: python script.py & It runs fine. When I log off ssh I...
0
by: Jeffery Tyree | last post by:
I have a machine that will be used to demo some Excel spreadsheets at a convention. Because I did not author the spreadsheets and attendees will be allowed to play with the spreadsheets, I needed...
0
by: Alfred Whitney | last post by:
I wanted to write some code purely on Linux, but unfortunately the document scanner drivers are non-existent for the high-end commercial document scanners. So, I had to port my Linux PHP project to...
0
by: jbenezech | last post by:
Hi all , I have a perl/java app running under Win32. The application consists of a perl service (Win32::Daemon) and of java classes. The perl service calls every xx hours java classes to perform...
3
by: somuchh8 | last post by:
Hi, I'm having a lot of trouble with the Win32::Spawn module in perl. Here is my situation, I have a Win32::Spawn call which looks like this: my $success = undef; my $cmdline =...
3
by: sophie_newbie | last post by:
Hi, I'm running a python cgi script on a frontend web server and I want it to spawn another script (that takes a long time to run) on a backend number crunching server thats connected to the...
0
by: MeoLessi9 | last post by:
I have VirtualBox installed on Windows 11 and now I would like to install Kali on a virtual machine. However, on the official website, I see two options: "Installer images" and "Virtual machines"....
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:
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: jfyes | last post by:
As a hardware engineer, after seeing that CEIWEI recently released a new tool for Modbus RTU Over TCP/UDP filtering and monitoring, I actively went to its official website to take a look. It turned...
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.