473,396 Members | 1,871 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,396 software developers and data experts.

Getting the result of a process after exec*()

Hi,

I am trying to write a Python script that takes a ZIP file from a web
form (using CGI) and uses either of the UN*X unzip, gunzip, tar,
bunzip2 utilities to expand it.

I can use Python to save the script to disk; but processing it is
another matter. If for example I have received a *.tar.gz file, I need
to first pass it through gunzip; then through the tar utility. I also
want to process the resulting directory.

The problem for me is this: once an external process is called via
exec*() the script has effectively fulfilled its task. Is there any
way one can process a file with an external process and continue
further processing in Python; /once the external processing is
completed/?

Many thanks,

Andrew

Aug 17 '07 #1
2 1581
On 8/17/07, AndrewTK <at**********@gmail.comwrote:
The problem for me is this: once an external process is called via
exec*() the script has effectively fulfilled its task. Is there any
way one can process a file with an external process and continue
further processing in Python; /once the external processing is
completed/?
Assuming you're looking at the docs for the os module, instead of the
exec*() functions, check out the spawn*() functions, or, to use a
subshell, system(). Better yet, take a look at the subprocess module:
http://docs.python.org/lib/module-subprocess.html

-Miles
Aug 17 '07 #2
On 17 Sie, 16:33, AndrewTK <atkedzier...@gmail.comwrote:
Hi,

I am trying to write a Python script that takes a ZIP file from a web
form (using CGI) and uses either of the UN*X unzip, gunzip, tar,
bunzip2 utilities to expand it.

I can use Python to save the script to disk; but processing it is
another matter. If for example I have received a *.tar.gz file, I need
to first pass it through gunzip; then through the tar utility. I also
want to process the resulting directory.

The problem for me is this: once an external process is called via
exec*() the script has effectively fulfilled its task. Is there any
way one can process a file with an external process and continue
further processing in Python; /once the external processing is
completed/?

Many thanks,

Andrew
Hi Andrew,

Have You got some kind of requirement for using exec*() and calling
system gunzip etc?
I'd do It with urllib2 module (to download the file) and tarfile
module for extracting the *.tag.gz archive.

Cheers,
Marek

Aug 18 '07 #3

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

Similar topics

2
by: uwnewsgroup | last post by:
When I was using Runtime.exec(String cmd) to run a unix utility (join), and try to get its standard output by using Process.getOutputStream(), it blocks forever. I tried it using Java 1.4 and...
5
by: Toby Donaldson | last post by:
Hi all, I'm designing an educational application that will run Python code and check the output against a pre-define answer. I want to use the "exec" statement to run the code, but I don't know...
8
by: Mario Pranjic | last post by:
Hi! Can anybody give me a hint how to put sa resut from EXEC into a variable. EXEC is called: EXEC(@TmpQuery) and it returns a single int value (SELECT COUNT(*) ....) Thanks!
8
by: R. Bernstein | last post by:
In doing the extension to the python debugger which I have here: http://sourceforge.net/project/showfiles.php?group_id=61395&package_id=175827 I came across one little thing that it would be nice...
8
by: mandydhaliwal | last post by:
Hi all, I am porting a win32 c++ program on Linux which first reads a list of processes and their paths from a file.Then this program should launch all of thesese processes. I tried to...
10
by: scoonie999 | last post by:
I'm having a problem that I can't seem to find any solution for online. I'm using a cursor in a cobol program to fetch some data. I know for a fact that the select should return 2 rows. The...
0
oll3i
by: oll3i | last post by:
import javax.swing.*; import java.awt.event.*; import java.util.ArrayList; import java.util.List; import java.util.concurrent.*; import java.lang.reflect.*; public class Exec1 extends JFrame...
1
by: Bibek4u | last post by:
Hi, Im using gdb for debugging my application.. I was able to debug child process(when fork comes) .. and in child process we have an exec call... So the problem is, when the control come to exec ,...
9
by: erikcw | last post by:
Hi, I have a cgi script where users are uploading large files for processing. I want to launch a subprocess to process the file so the user doesn't have to wait for the page to load. What is...
0
by: ryjfgjl | last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
0
by: emmanuelkatto | last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud. Please let me know. Thanks! Emmanuel
1
by: nemocccc | last post by:
hello, everyone, I want to develop a software for my android phone for daily needs, any suggestions?
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...

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.