Exemple #1
0
	def connect(self):
		"""
		Starts player-programm instance
		"""
		if self.ssh:
			sshaddress = '%s@%s' % (self.sshuser, self.sship)
			sys.command("%s %s %s:%s" % \
				(SCP_EXEC_PATH, self.botexe, sshaddress, PATH_TO_RUN) )
			sys.command("%s %s 'chmod +x %s'" % (SSH_EXEC_PATH, sshaddress, PATH_TO_RUN))
			sshargs = "'%s'" % PATH_TO_RUN
			self.__proc = subprocess.Popen(executable=SSH_EXEC_PATH, \
					args=sshargs, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
		else:
			self.__proc = subprocess.Popen(self.botexe, stdin=subprocess.PIPE, stdout=subprocess.PIPE)
Exemple #2
0
import sys
print sys.argv
sys.command("touch monkey")


def fib(n):
    if n == 1:
        return 1
    if n == 2:
        return 2
    return fib(n-1)+fib(n-2)

print fib(int(sys.argv[1]))