What is meant by "The arguments are the same as for the Popen constructor.", in Convenience Functions? In fact, what is such a function? This notation seems odd to me:
class subprocess.Popen(args, bufsize=0, executable=None, stdin=None, stdout=None, stderr=None, preexec_fn=None, close_fds=False ....
Why not just class Popen instead of subprocess.Popen?

Is there a suggestion here that I need only do:
myProg=Popen()
myProg.call("wolf", "-h")
where wolf is the executable C program?

Wayne Watson wrote:
Good. See my follow up to Alan's post for more details on what I'm doing. Apparently, not SWIG. Thanks for the Alan link.

Martin Walsh wrote:
Wayne Watson wrote:
  
If you can execute a C program compiled on a Linux with SWIG, then
that's what I'm looking for. There's really no RH dependency according
to the above posts. If it were compiled on Debian or Ubuntu, it appears
it would not make any difference. That is, one could execute a RH
executable from C on Ubuntu.
    

Yeah, probably -- if it's a static build, or if the dependencies
(required libraries/versions) are installed, assuming the program has
dependencies. But, I suppose we may be drifting a bit OT.

  
Is there a simple example of this in action from a Python program and
some small C Linux executable program?
    

http://docs.python.org/library/subprocess.html

The subprocess module is commonly recommended for this type of task (as
opposed to os.system, etc). In fact, I believe Alan already suggested it
in this thread. And speaking of ... Alan's tutorial has several very
good examples of using the subprocess module (OS topic under
Manipulating Processes).

http://www.freenetpages.co.uk/hp/alan.gauld/tutos.htm

---

I'll hazard a wild guess that you don't really want SWIG based on your
original question, and subsequent comments. IIUC, SWIG is intended to
ease the creation of a python wrapper (extension module) for existing
C/C++ code. And, I'm not sure you've given enough information about the
C program to determine if SWIG would be useful. Regardless, I suggest
you get a feel for running an external program using python first.

HTH,
Marty

_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

  

--
Signature.html
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)


                Life is one damn thing after another."
                     -- Mark Twain 
  

_______________________________________________ Tutor maillist - Tutor@python.org http://mail.python.org/mailman/listinfo/tutor

--
Signature.html
           Wayne Watson (Watson Adventures, Prop., Nevada City, CA)

             (121.01 Deg. W, 39.26 Deg. N) GMT-8 hr std. time)


                Life is one damn thing after another."
                     -- Mark Twain 
_______________________________________________
Tutor maillist  -  Tutor@python.org
http://mail.python.org/mailman/listinfo/tutor

Reply via email to