Having some trouble sending data from python script to other function
Hello,
I'm trying to send the output of a python script to another command. I am trying to do this within the python script itself but can also write a bash script if someone can direct me to the commands I should be using. This is the part of the python script Im having trouble with. Im trying to push the printed number to the qbus command. Code:
# Now either print out the forwarded port or an error message. |
probably this:
Code:
os.system("qdbus org.ktorrent.ktorrent /settings setPort [%s] : qdbus org.ktorrent.ktorrent /settings apply" % ( resp["port"] )) |
Quote:
Its not imputing the result of the python script to the command and my ktorrent port is coming out to 0. Here is the full python script(which works perfectly without my extra part): Code:
#!/usr/bin/env python Code:
$ qdbus org.ktorrent.ktorrent /settings setPort (number I get from python script) I want to have this command run automatically within the python script. |
I see. Try to remove [ and ] around the port number:
Code:
os.system("qdbus org.ktorrent.ktorrent /settings setPort %s; qdbus org.ktorrent.ktorrent /settings apply" % ( resp["port"] )) os.system("echo qdbus org..... |
Quote:
|
If anyone does a google search for it. This is the python script I am using for Private internet access and Ktorrent to get my ports.
I did not write this python script. It was found on the private internet access help forum but now it will automatically change the port number for Ktorrent. for the xxxxxx put in your own information and you need netfaces installed with the python bindings. Code:
#!/usr/bin/env python |
All times are GMT -5. The time now is 12:19 PM. |