[pypy-svn] r47091 - pypy/dist/demo/distribution
fijal at codespeak.net
fijal at codespeak.net
Tue Oct 2 12:02:07 CEST 2007
Author: fijal
Date: Tue Oct 2 12:02:06 2007
New Revision: 47091
Modified:
pypy/dist/demo/distribution/fileclient.py
pypy/dist/demo/distribution/fileserver.py
Log:
Improve docs, use code.interact as pypy-c -i might be buggy
Modified: pypy/dist/demo/distribution/fileclient.py
==============================================================================
--- pypy/dist/demo/distribution/fileclient.py (original)
+++ pypy/dist/demo/distribution/fileclient.py Tue Oct 2 12:02:06 2007
@@ -1,14 +1,25 @@
""" This is sample client for a server based in fileserver.py, not counting
-initialization and __doc__ has just 2 lines. Usage:
+initialization, code.interact and __doc__ has just 2 lines! Usage:
-pypy-c -i fileclient.py
+pypy-c fileclient.py
+
+The file_opener is a proxy for remote file object. Which means you can
+perform same operations as locally, like file_opener('/etc/passwd').read()
+or file_opener('/tmp/x', 'w').write('x')
+
+pypy-c needs to be compiled with --allworkingmodules in order to have socket
+working.
"""
+
HOST = '127.0.0.1'
PORT = 12221
from distributed.socklayer import connect
file_opener = connect((HOST, PORT)).open
-# now you can do for example file_opener('/etc/passwd').read() to
-# read remote /etc/passwd
+import code
+code.interact(local=locals())
+# The file_opener is a proxy for remote file object. Which means you can
+# perform same operations as locally, like file_opener('/etc/passwd').read()
+# or file_opener('/tmp/x', 'w').write('x')
Modified: pypy/dist/demo/distribution/fileserver.py
==============================================================================
--- pypy/dist/demo/distribution/fileserver.py (original)
+++ pypy/dist/demo/distribution/fileserver.py Tue Oct 2 12:02:06 2007
@@ -3,8 +3,11 @@
fully operational file server,
sample client which is in fileclient.py is included as well.
-Note that you must run it with pypy-c compiled with transparent proxy
-and allworkingmodules (or at least socket and select)
+run by:
+pypy-c fileserver.py
+
+pypy-c needs to be compiled with --allworkingmodules in order to have socket
+working.
"""
HOST = '127.0.0.1' # defaults to localhost, not to export your files
More information about the Pypy-commit
mailing list