Python

NAVIGATION
CATEGORIES
REFERRENCE
LINKS
  • Popen4 and Paths Containing Spaces

    0 answers - 2369 bytes - related search similar search Add To My Delicious Add To My Stumble Upon Add To My Google Mark Add To My Facebook Add To My Digg Add To My Reddit

    I am having problems with using the Winzip command line tools and Python.
    Here is an example of the several dozen different ways I have tried to
    execute the Wzzip.exe utility with arguments using
    popen2 -
    This works (just runs the utility with not arguments ):
    cmd = "\"d:/program files/winzip/wzzip.exe\""
    results = popen2.popen4( cmd )
    However this fails miserably:
    testpath = "D:/Program Files/WebTrends/SmartSource Data
    Collector/weblog/*.log"
    cmd = "\"d:/program files/winzip/wzzip.exe\" -ma test.zip \"" + testpath
    + "\""
    results = popen2.popen4( cmd )
    If I set the script to print out the value stored in the variable "cmd" it
    says this:
    "d:/program files/winzip/wzzip.exe\" -ma test.zip "D:/Program
    Files/WebTrends/SmartSource Data Collector/weblog/*.log"
    Which if I paste it onto the command line, does exactly what I intend it to
    do. But for some reason, popen2.popen4(cmd) gives this as output ( from
    stderr ):
    'd:/program' is not a file or command
    My only guess is that popen2.popen4 is parsing the string differently than
    the "print" command does, because print recognizes that the backslash is
    escaping the double quotes ( e.g. "\"" ) in the string, and popen does not.
    the other hand, it appears to be recognizing it in my first example, so
    that is what is really confusing me. It isn't consistent at all.
    Any ideas?
    John A. Gooch
    "May the Python-force be with youalways."
    Systems Administrator
    EchoStar Satellite L.L.C.
    Desk: 720-514-5708
    Message
    From: tutor-bounces (AT) python (DOT) org [mailto:tutor-bounces (AT) python (DOT) org] Behalf
    Danny Yoo
    Sent: Tuesday, June 14, 2005 4:21 PM
    To: Pujo Aji
    Cc: Tutor
    Subject: Re: [Tutor] can't see emacs timer in action
    Tue, 14 Jun 2005, Pujo Aji wrote:
    I tried this code in emacs.
    for i in range(3):
    time.sleep(1)
    print i
    It shows the result but total result not second per second.
    Hi Pujo,
    In Emacs, you may want to first start up a Python subprocess by using the
    keystroke:
    C-c !
    and then run Python buffers with:
    C-c C-c
    Best of wishes!
    Tutor maillist - Tutor (AT) python (DOT) org
    Tutor maillist - Tutor (AT) python (DOT) org

Re: Popen4 and Paths Containing Spaces


max 4000 letters.
Your nickname that display:
In order to stop the spam: 3 + 2 =
QUESTION ON "Python"

EMSDN.COM