pycurious/fix

annotate basic/example.py @ 1:1f54edaaab02

Added SWIG typemap example.
author James Brotchie <brotchie@gmail.com>
date Fri Dec 04 22:50:30 2009 +1000 (2 years ago)
parents
children
rev   line source
brotchie@1 1 """
brotchie@1 2 Example to exercise the test SWIG module.
brotchie@1 3
brotchie@1 4 """
brotchie@1 5 import os
brotchie@1 6 import test
brotchie@1 7
brotchie@1 8 # Create and open pipe as file objects
brotchie@1 9 (r,w) = os.pipe()
brotchie@1 10 fr, fw = os.fdopen(r, 'r'), os.fdopen(w, 'w')
brotchie@1 11
brotchie@1 12 # Write and close
brotchie@1 13 fw.write('Hello World')
brotchie@1 14 fw.close()
brotchie@1 15
brotchie@1 16 # Read data from pipe using test module
brotchie@1 17 print test.message(fr)
brotchie@1 18
brotchie@1 19