/usr/share/doc/python-nwsclient/examples/hello.py is in python-nwsclient 1.6.4-8build1.
This file is owned by root:root, with mode 0o755.
The actual contents of the file can be viewed below.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 | #!/usr/bin/env python
import sys, socket
host = "localhost"
port = 8765
wsname = "hello"
try:
from nws.client import NetWorkSpace
nws = NetWorkSpace(wsname, host, port)
count = int(raw_input("Number of times to loop? "))
print "hello: iterations:", count
nws.store("hello example", count)
for i in range(count):
nws.store("hello", i)
j = nws.fetch("hello")
nws.fetch("hello example")
print "Success"
except KeyboardInterrupt:
print "hello exiting"
except ImportError:
print "Unable to import the nwsClient module"
print "You may need to set or correct your PYTHONPATH"
except socket.error:
print "NWS server not running on %s, port %d" % (host, port)
except:
print "An unexpected error occurred:", sys.exc_info()[1]
|