command string good in subprocess.Popen(string) fails inprocess.Process(string)

Discussion in 'Python' started by Earl Eiland, May 16, 2005.

  1. Earl Eiland

    Earl Eiland Guest

    The command string consists of "filename.exe instruction1 instruction2
    ...." It works in subprocess, but in process, returns the error "can't
    find the file instruction1".

    How do I pass command line instructions in process.Process? I tried a
    list ['filename.exe', 'instruction1 instruction2 ...'] with the same
    result.

    If you're wondering why I'm switching, it's because I'm working with a
    poorly behaved 3rd party program that causes a severe memory leak, and I
    need the process modules timed "wait(n)" method (or write my own).

    Earl
     
    Earl Eiland, May 16, 2005
    #1
    1. Advertising

  2. Earl Eiland

    Peter Hansen Guest

    Re: command string good in subprocess.Popen(string) fails in process.Process(string)

    Earl Eiland wrote:
    > The command string consists of "filename.exe instruction1 instruction2
    > ..." It works in subprocess, but in process, returns the error "can't
    > find the file instruction1".
    >
    > How do I pass command line instructions in process.Process? I tried a
    > list ['filename.exe', 'instruction1 instruction2 ...'] with the same
    > result.


    Where are you getting this "process" module from? It's not standard:

    c:\>python
    Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
    >>> import process

    Traceback (most recent call last):
    File "<stdin>", line 1, in ?
    ImportError: No module named process


    -Peter
     
    Peter Hansen, May 16, 2005
    #2
    1. Advertising

  3. Earl Eiland

    Earl Eiland Guest

    from Trent Mick :
    "You might be able to use or borrow code from my process.py module.
    process.py is very similar to Python 2.4's subprocess. It provides a
    ProcessOpen class (similar to subprocess' Popen). A ProcessOpen instance
    has wait() and kill() methods that work fine on Windows. Under the hood
    they are using the Win32 API WaitForSingleObject() and
    TerminateProcess() functions."

    http://starship.python.net/~tmick/"

    On Mon, 2005-05-16 at 07:27, Peter Hansen wrote:
    > Earl Eiland wrote:
    > > The command string consists of "filename.exe instruction1 instruction2
    > > ..." It works in subprocess, but in process, returns the error "can't
    > > find the file instruction1".
    > >
    > > How do I pass command line instructions in process.Process? I tried a
    > > list ['filename.exe', 'instruction1 instruction2 ...'] with the same
    > > result.

    >
    > Where are you getting this "process" module from? It's not standard:
    >
    > c:\>python
    > Python 2.4 (#60, Nov 30 2004, 11:49:19) [MSC v.1310 32 bit (Intel)] on win32
    > >>> import process

    > Traceback (most recent call last):
    > File "<stdin>", line 1, in ?
    > ImportError: No module named process
    >
    >
    > -Peter
     
    Earl Eiland, May 16, 2005
    #3
  4. Earl Eiland

    Peter Hansen Guest

    Re: command string good in subprocess.Popen(string) fails in process.Process(string)

    Earl Eiland wrote:
    > from Trent Mick :
    > "You might be able to use or borrow code from my process.py module.


    Few here have ever heard of it, I suspect. Maybe you should ask Trent
    for help?
    >
    >>Earl Eiland wrote:
    >>
    >>>The command string consists of "filename.exe instruction1 instruction2
    >>>..." It works in subprocess, but in process, returns the error "can't
    >>>find the file instruction1".
    >>>
    >>>How do I pass command line instructions in process.Process? I tried a
    >>>list ['filename.exe', 'instruction1 instruction2 ...'] with the same
    >>>result.


    The docs (in the form of the Powerpoint presentation on his site, which
    I'm reading using OpenOffice) suggest maybe you should be using
    ['filename.exe', 'instruction1', 'instruction2', ...] instead...

    -Peter
     
    Peter Hansen, May 16, 2005
    #4
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Trent Mick
    Replies:
    0
    Views:
    498
    Trent Mick
    May 16, 2005
  2. bahoo
    Replies:
    1
    Views:
    500
    Marc 'BlackJack' Rintsch
    Apr 25, 2007
  3. newton10471
    Replies:
    3
    Views:
    481
    newton10471
    Mar 25, 2010
  4. Niklas Berliner
    Replies:
    0
    Views:
    178
    Niklas Berliner
    Jan 10, 2013
  5. Dave Angel
    Replies:
    0
    Views:
    156
    Dave Angel
    Jan 10, 2013
Loading...

Share This Page