By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
446,156 Members | 1,004 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 446,156 IT Pros & Developers. It's quick & easy.

os.system prob

P: n/a


Hello,

I am trying to send some commands via os.system but am getting tripped
up by it stripping out the quote marks. I have:

program = "dcop klipper klipper setClipboardContents "
fileOut = '"test = FileOut(0,
"/bobbleheads/shots/bh112_01/roto_neck/ramin/renders/test", "Auto");"'

The fileOut string must be enclosed with "'s and also contains several "'s.

So I put them togeter

command = program + fileOut
os.system(command)

My clipboard then contains

test = FileOut(0,
/bobbleheads/shots/bh112_01/roto_neck/ramin/renders/test, Auto);

all of the " have been stripped out.

I need it to contain

"test = FileOut(0,
"/bobbleheads/shots/bh112_01/roto_neck/ramin/renders/test", "Auto");"

any ideas??

ps - this may only work under KDE. If there are python specific commands
to put things in the clip board
I can't find them??
Thanks in advance.

Jul 18 '05 #1
Share this Question
Share on Google+
1 Reply


P: n/a
In article <ma**************************************@python.o rg>,
Aaron Barclay <aa****@jhcs.co.uk> wrote:
I am trying to send some commands via os.system but am getting tripped
up by it stripping out the quote marks. I have:


Quoting can be tricky, when you have multiple layers of
interpretation - python, shell, etc. You can probably
figure it out with some experimentation, but if possible
it's better to avoid the problem. Use os.spawnv - like,

os.spawnv(os.P_WAIT, '/usr/local/bin/whatever',
['whatever', 'parameter one'])

This invokes the command directly, so there's no shell
command line parsing.

Donn Cave, do**@u.washington.edu
Jul 18 '05 #2

This discussion thread is closed

Replies have been disabled for this discussion.