You Are Here:

Community: Developer Discussion Boards

#1 Old Question Problem using os.system() - 2009-06-30, 22:53

Join Date: Jun 2009
Posts: 1
soniawon
Offline
Registered User
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?
Reply With Quote

#2 Old Re: Problem using os.system() - 2009-07-01, 09:54

Join Date: Aug 2003
Posts: 1,005
Location: Oulu, Finland
laa-laa's Avatar
laa-laa
Offline
Forum Nokia Champion
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
Reply With Quote
Reply « Previous Thread | Next Thread »
Display Modes
Thread Tools Search this Thread
Search this Thread:

Advanced Search
Rate This Thread
Rate This Thread:

Posting Rules

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

vB code is On
Smilies are On
[IMG] code is Off
HTML code is Off
Forum Jump
Similar Threads
Thread Thread Starter Forum Replies Last Post
STLPort namespace issue yickhong Open C/C++ 0 2009-04-09 09:54
SyncML link problem samuel_ General Symbian C++ 4 2009-03-27 09:02
Problem with eglSwapBuffers and heap corruption greatape Symbian Media (Graphics & Sounds) 2 2007-05-24 04:35
netcards - Problem with opening adapter kernj Symbian Tools & SDKs 5 2007-01-10 09:56
Problem: S60 SDK for CW in PC with .NET anttij Carbide.c++ IDE and plug-ins 1 2005-02-28 12:36

Rate This

 
Bookmark this page: DeliciousDiggFacebookGoogleYahooStumbleUponRedditDiigoTechnocratiTwitter  Share this page Share this page Print this Page Print this page Invite a friend Invite a friend
京ICP备05048969号    Email Newsletters Press Terms & Conditions Privacy Policy Sitemap Contact Us © 2009 Nokia