Esempio n. 1
0
from telepythy import Remote

h = Remote('localhost')


def getfile(filename="/etc/hosts"):
    return open(filename).read()


try:
    print(h.run(getfile))
    h.close()
except Exception as e:
    print("Handled Exception...")
    print(e)
Esempio n. 2
0
from telepythy import Remote

def do_remote_thing(dir='/'):
    import os
    print "I am remote!"
    return os.listdir(dir)

server = 'localhost'

s = Remote(server)
try:
    dir_list = s.run(
        do_remote_thing,
        dir="/usr"
    )
except Exception as e:
    print 'I even handle remote exceptions! %s'%e

for dir in dir_list:
    print(dir)
Esempio n. 3
0
from telepythy import Remote

def do_remote_thing(dir='/'):
    import os
    print("I am remote!")
    return os.listdir(dir)

s = Remote('localhost')

try:
    dir_list = s.run(
        do_remote_thing,
        dir="/usr"
    )
except Exception as e:
    print('I even handle remote exceptions! %s'%e)

for dir in dir_list:
    print(dir)
Esempio n. 4
0
from telepythy import Remote

h = Remote('localhost')


def getfile(filename="/etc/hosts"):
    return open(filename).read()


try:
    print h.run(getfile)
    h.close()
except Exception as e:
    print "Handled Exception..."
    print e