Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html Yes, sounds like you got the code, and I need to go outside this group to a Cygwin forum/NG or Linux under Win. Recently, I was working with a fellow associated with this effort who knows Linux very well. He had some slight difficulty with the Makefiles, but finally got it

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Michael Farnham
On Fri, 2009-03-20 at 04:35 -0700, Wayne Watson wrote: > Good. Thanks. > > Here's my code. > == > # Executing a Linux program under Win XP > from subprocess import call > myProg = call(["C:\Sandia_Meteors\Various\FuzzyLogic\wolf", "-h"]) If I understand your question - A C program which

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread greg whittier
On Fri, Mar 20, 2009 at 1:41 PM, Wayne Watson wrote: > Yes, I'm sure I'll need help. I just posted a message minutes before yours > mentioning I'm willing to try Cygwin. The C program, wolf, is the public > domain If trying to compile the program under Win is what you had in mind, > then I can s

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html Yes, I'm sure I'll need help. I just posted a message minutes before yours mentioning I'm willing to try Cygwin. The C program, wolf, is the public domain  If trying to compile the program under Win is what you had in mind, then I can send you all the necessary files in a

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html That's a lot of text to respond to, but let me see if I can broadly do it. It appears that the idea of executing Linux code under Win XP is d-e-a-d. (Let's ignore VM) I will need to recompile the c-code in some way under Win XP. Probably Cygwin. The python code I'm workin

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread greg whittier
On Fri, Mar 20, 2009 at 1:01 PM, Wayne Watson wrote: > To be clear. The program I'm trying to execute under Win XP was compiled > on a RH Linux machine. It was not compile on a Win OS machine. It may sound > far fetched some facility might be available to do this, but somewhere in my > very, very

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > Neither Python proper nor Popen() are actually executing the program - the > Windows shell/command interpreter does that (command.com or cmd.exe, > depending on your Windows version); Popen() is just a mechanism for making > the request, wai

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Elena of Valhalla
On Fri, Mar 20, 2009 at 6:01 PM, Wayne Watson wrote: > To be clear. The program I'm trying to execute under Win XP was compiled on > a RH Linux machine. It was not compile on a Win OS machine. It may sound far > fetched some facility might be available to do this, but somewhere in my > very, very

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 10:02 AM, Marc Tompkins wrote: > If you want to run a non-Windows executable on Windows, you need to use an > alternate shell - someone mentioned Cygwin - although I'm not certain that > even that will do it for you. What makes an executable OS-specific is not > the langua

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Marc Tompkins
On Fri, Mar 20, 2009 at 8:46 AM, Wayne Watson wrote: > I guess I haven't made clear above. This is a Red Hat Linux compiled C > program. Indications from others above, suggest it is possible to execute it > under Win Python. If that's true, then my guess is that something prior to > the call must

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html To be clear. The program I'm trying to execute under Win XP was compiled on a RH Linux machine. It was not compile on a Win OS machine. It may sound far fetched some facility might be available to do this, but somewhere in my very, very distant past before the small comput

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html You understand it perfectly. Michael Farnham wrote: On Fri, 2009-03-20 at 04:35 -0700, Wayne Watson wrote: Good. Thanks. Here's my code. == # Executing a Linux program under Win XP from subprocess import call myProg = call(["C:\Sandia_Meteors\Various

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html I guess I haven't made clear above. This is a Red Hat Linux compiled C program. Indications from others above, suggest it is possible to execute it under Win Python. If that's true, then my guess is that something prior to the call must be done in the way of informing the

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread A.T.Hofkamp
Wayne Watson wrote: Yes, good, but I tried myProg = call([r"C:\Sandia_Meteors\Various\FuzzyLogic\wolf", "-h"]), and get exactly the same results. So the next step is to find out what is wrong. In other words, experiment with the problem to get an understanding what is not working. Once you ge

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html Yes, good, but I tried myProg = call([r"C:\Sandia_Meteors\Various\FuzzyLogic\wolf", "-h"]), and get exactly the same results. A.T.Hofkamp wrote: Wayne Watson wrote: Good. Thanks. Here's my code. == # Executing a Linux program under Win XP

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread A.T.Hofkamp
Wayne Watson wrote: Good. Thanks. Here's my code. == # Executing a Linux program under Win XP from subprocess import call myProg = call(["C:\Sandia_Meteors\Various\FuzzyLogic\wolf", "-h"]) You must always escape \ characters in a string. do r"C:\Sandia_Meteors\Various\FuzzyLogic\wolf"

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Wayne Watson
Title: Signature.html Good. Thanks. Here's my code. == # Executing a Linux program under Win XP from subprocess import call myProg = call(["C:\Sandia_Meteors\Various\FuzzyLogic\wolf", "-h"]) == But msgs are produced ... Traceback (most recent call last):   File "C:/Sandia_Meteo

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-20 Thread Alan Gauld
"Wayne Watson" wrote What is meant by "The arguments are the same as for the Popen constructor.", in Convenience Functions? In fact, what is such a function? It means that there is a function which takes the same arguments as the __init__() method of the Popen class. They are convenience f

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-19 Thread Wayne Watson
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

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-19 Thread Wayne Watson
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 de

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-19 Thread ALAN GAULD
> likely will allow the user to enter the 12 or so parameters > on the command line, and execute the program as though > I had entered it at a Linux prompt. OK, In that case you only need the call() convenience function from the subprocess module. Capture the arguments in your GUI and build t

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-19 Thread Wayne Watson
Title: Signature.html "I think it this case it requires executing the program command line with parameters then executing it." That is, I likely will allow the user to enter the 12 or so parameters on the command line, and execute the program as though I had entered it at a Linux prompt. The pr

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-19 Thread Alan Gauld
"Wayne Watson" wrote If you can execute a C program compiled on a Linux with SWIG, then that's what I'm looking for. Nope, you need the suprocess module not SWIG. What SWIG does (fairly easily!) is allow you to build a wrapper around your C program that python can import and call the C fun

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Martin Walsh
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

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Wayne Watson
Title: Signature.html 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

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread greg whittier
On Wed, Mar 18, 2009 at 4:06 PM, Wayne Watson wrote: > Thanks to both above posts before this reply. > I'll forgo the VM route. It would really complicate things for the users of > the application having to deal with VM. Most are near neophytes. > Nevertheless, it looks like there may be some hope

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Wayne Watson
Title: Signature.html Thanks to both above posts before this reply. I'll forgo the VM route. It would really complicate things for the users of the application having to deal with VM. Most are near neophytes. Nevertheless, it looks like there may be some hope here for just doing it from w/i Win

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Alan Gauld
"Wayne Watson" wrote The Subject contains the interest here. Can it be done? A C program is compiled into a binary executable complete with link loader. The executable is not portable across operating systems (nor hardware architectures in most cases) I think it this case it requires execu

Re: [Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Robert Berman
Wayne, I think I do the opposite of what you are doing. I develop in Python on a Linux (Ubuntu 8.10) box. On that box, I also run a virtual copy of Windows XP in its own little happy environment. That way, when my XP customers have a problem, I drop into the desktop environment running XP and

[Tutor] Executing a C Program from RH Linux in Python for Win

2009-03-18 Thread Wayne Watson
Title: Signature.html The Subject contains the interest here. Can it be done? I think it this case it requires executing the program command line with parameters then executing it? How dependent upon the C compiled code is this? That is, I would think various distributions of Linux might produc