Two days into python and I'm trying to do some simple things but struggling.
When I run the script below using ls as the example command input, ssh prompts me for password, then it spits out this:
<__main__.sshcommand object at 0x7fd0d1136b50>
If I hard set command inside of the sshcommand class (for instance replacing command with 'ls'), and print it, it works great.
Thanks for all advice in advance.
import subprocess
class sshcommand(object):
def __init__(self, command):
subprocess.check_output(['ssh', 'localhost', command]).splitlines()
command = raw_input("command> ")
print sshcommand(command)