forked from AllenDowney/ThinkPython
-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathPopupClient.py
More file actions
27 lines (21 loc) · 722 Bytes
/
PopupClient.py
File metadata and controls
27 lines (21 loc) · 722 Bytes
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
"""This module is part of an exercise for
Think Python: an Introduction to Software Design
Copyright 2011 Allen B. Downey
License: GNU GPLv3 http://www.gnu.org/licenses/gpl.html
"""
import sys
import Pyro.errors
from remote_object import NameServer
def main(script, to='downey', message='hello', sender='downey', *args):
"""Contact the remote object with the given name and
invoke popup with the given message"""
ns = NameServer()
try:
name = 'popup_%s' % to
server = ns.get_proxy(name)
except Pyro.errors.NamingError:
print "I can't find a remote object named " + name
return
print server.popup(message, sender)
if __name__ == '__main__':
main(*sys.argv)