Python: Using strings to run commands in os.system('')
I was zsync-ing the latest Ubuntu 11.10 Alpha and thought I'd make a little GUI for it as a small project. The gui is set up, I just need to figure out how to run zsync with content from to variables, cto and cfrom. I tried the following code:
Code:
os.system('zsync -i ' + cto + ' ' + cfrom) Code:
Traceback (most recent call last): Thanks! :D |
Maybe try using formatting directives:
Code:
os.system('zsync -i {0} {1}'.format(cto, cfrom)) |
What if you concatenate into a single string and pass that to os.system()?
|
No Dice
Wait a minute, it must be an issue with how I'm assigning text to variables...
This is wrong, it't it: Code:
cto = self.copy_to.get_text |
I guess get_text is a function, so you have to call it to get the text:
Code:
cto = self.copy_to.get_text() |
All times are GMT -5. The time now is 04:15 AM. |