×

Discussion Board

Results 1 to 2 of 2
  1. #1
    Registered User
    Join Date
    Jun 2009
    Posts
    1

    Question Problem using os.system()

    Hi,

    I'm writing a small method to replace some text in a file.
    The only argument I need is the new text, as it is always the same file and text to be replaced.

    I'm having a problem using the os.system() call, when I try to use the argument of the method

    If I use a string like below, everything runs ok:

    stringId = "GRRRRRRRRR"
    cmd="sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
    os.system(cmd)


    Now, if i try to give a string as a parameter like below, the command is not executed.
    I do a print to see if the command is correct, and it is. I can even execute it with success if I copy / paste to my shell

    import os
    def updateExportConfigId(id):
    stringId = "%s" % id
    cmd= "sed '1,$s/MANAGER_ID=[0-9]*/MANAGER_ID=" + stringId + "/g' path/file.old > path/file.new"
    print "command is " + cmd
    os.system(cmd)


    Does anyone knows what is wrong?

  2. #2
    Registered User
    Join Date
    Aug 2003
    Location
    Oulu, Finland
    Posts
    1,122

    Re: Problem using os.system()

    Hello and welcome to Forum Nokia.

    However, this forum is specially for the Python for S60 (PyS60). For non-PyS60 Python questions, you will probably get better answers at other programming Q&A sites, for example StackOverflow.

    Lauri

Similar Threads

  1. STLPort namespace issue
    By yickhong in forum Open C/C++
    Replies: 0
    Last Post: 2009-04-09, 08:54
  2. SyncML link problem
    By samuel_ in forum Symbian
    Replies: 4
    Last Post: 2009-03-27, 08:02
  3. Problem with eglSwapBuffers and heap corruption
    By greatape in forum Symbian Media (Closed)
    Replies: 2
    Last Post: 2007-05-24, 03:35
  4. netcards - Problem with opening adapter
    By kernj in forum Symbian Tools & SDKs
    Replies: 5
    Last Post: 2007-01-10, 08:56
  5. Problem: S60 SDK for CW in PC with .NET
    By anttij in forum Carbide.c++ IDE and plug-ins (Closed)
    Replies: 1
    Last Post: 2005-02-28, 11:36

Posting Permissions

  • You may not post new threads
  • You may not post replies
  • You may not post attachments
  • You may not edit your posts
  •  
×