Re: Win XP: Problem with shell scripting in Python

2006-06-12 Thread A.M
>Does it overcome the problem that you reported earlier, that the contents of the output file from BCP were out of order? Yes, it does. But, to be honest, I don't know how!!! "John Machin" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > On 10/06/2006 3:00 AM, A.M wrote: >> He

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread John Machin
On 10/06/2006 3:00 AM, A.M wrote: > Here is what I came up with after John and Fredrik's help. > > import os > import sys > def Execute(shell_command,logStream = sys.stdout): > print >>logStream, shell_command > child_stdin, child_stdout_and_stderr = os.popen4(shell_command) > commad_

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread A.M
Here is what I came up with after John and Fredrik's help. import os import sys def Execute(shell_command,logStream = sys.stdout): print >>logStream, shell_command child_stdin, child_stdout_and_stderr = os.popen4(shell_command) commad_output = child_stdout_and_stderr.read()

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Steve Holden
A.M wrote: >>I dare hardly suggest this, but might it not be better to use Python's >>database functionality to perform the task? The language can access both >>databases, and you might find it quicker. Then again, if your database >>experience is limited, you may not ... >> >>regards >> Steve >>

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread A.M
> I dare hardly suggest this, but might it not be better to use Python's > database functionality to perform the task? The language can access both > databases, and you might find it quicker. Then again, if your database > experience is limited, you may not ... > > regards > Steve > -- > Steve

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Steve Holden
A.M wrote: > "Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message > news:[EMAIL PROTECTED] > >>A.M wrote: >> >> >>in python, "MD" is spelled os.mkdir. >> >> >>>Am I missing anything? >> >>the difference between STDOUT and STDERR, and the difference between >>buffered output and non-buffered outp

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread A.M
"Fredrik Lundh" <[EMAIL PROTECTED]> wrote in message news:[EMAIL PROTECTED] > A.M wrote: > > > in python, "MD" is spelled os.mkdir. > >> Am I missing anything? > > the difference between STDOUT and STDERR, and the difference between > buffered output and non-buffered output, and perhaps a few ot

Re: Win XP: Problem with shell scripting in Python

2006-06-09 Thread Fredrik Lundh
A.M wrote: > It works very fine with DIR command, but for commands like "MD :" it doesn't > return the error message into the string: > > print os.popen('MD :').read() > > # No error message in python, "MD" is spelled os.mkdir. > Am I missing anything? the difference between STDOUT and STDER

Re: Win XP: Problem with shell scripting in Python

2006-06-08 Thread John Machin
On 9/06/2006 10:47 AM, John Machin wrote: > Now it's *your* turn to do something for the cause. It appears to me > that popen4 has exactly the same documentation as popen3, as recently as > 2.5a2. I see no fourth gizmoid here. > > Whoooaaah! "4" is not a gizmoid count: > > |>>> handles = os.po

Re: Win XP: Problem with shell scripting in Python

2006-06-08 Thread John Machin
On 9/06/2006 8:58 AM, A.M wrote: > Hi, > I am having difficulty with shell scripting in Python. > I use the following command to run a DOS command and put the return value in > a Python variable: > print os.popen('DIR').read() > It works very fine with DIR command, but for commands like "MD :" it