summaryrefslogtreecommitdiff
path: root/demo/readdir2.py
diff options
context:
space:
mode:
authormattip <matti.picus@gmail.com>2015-11-24 21:50:04 +0200
committermattip <matti.picus@gmail.com>2015-11-24 21:50:04 +0200
commit68840c846ca7ffff6a99ae9b5d3f156c8623a373 (patch)
treecb275e08d6357d4a28e3a29b3f6a5a239247a0bd /demo/readdir2.py
parent5043f478b1ff4b3a1d03d0b9869ea32fbb4c61c5 (diff)
downloadcffi-68840c846ca7ffff6a99ae9b5d3f156c8623a373.tar.gz
update and cleanup more demos
Diffstat (limited to 'demo/readdir2.py')
-rw-r--r--demo/readdir2.py12
1 files changed, 10 insertions, 2 deletions
diff --git a/demo/readdir2.py b/demo/readdir2.py
index 5927a77..64fc60f 100644
--- a/demo/readdir2.py
+++ b/demo/readdir2.py
@@ -1,11 +1,19 @@
-# A Linux-only demo, using verify() instead of hard-coding the exact layouts
+# A Linux-only demo, using set_source() instead of hard-coding the exact layouts
#
import sys
-from _readdir2 import ffi, lib
if not sys.platform.startswith('linux'):
raise Exception("Linux-only demo")
+# If the build script was run immediately before this script, the cffi module
+# ends up in the current directory. Make sure we can import it.
+sys.path.append('.')
+
+try:
+ from _readdir2 import ffi, lib
+except ImportError:
+ print 'run readdir2_build first, then make sure the shared object is on sys.path'
+ sys.exit(-1)
def walk(basefd, path):
print '{', path