From 8add63faa3b2cf2cbae18345f3caf21fdded234c Mon Sep 17 00:00:00 2001 From: "W. Trevor King" Date: Tue, 13 Mar 2012 09:12:41 -0400 Subject: [PATCH] Adjust `sys.path` before importing `mmap` in `demo/python/mmap.py`. With the previous implementation, `mmap` was importing the demo script, not the standard `mmap` library module. From the docs [1]: The directory containing the script being run is placed at the beginning of the search path, ahead of the standard library path. This means that scripts in that directory will be loaded instead of modules of the same name in the library directory. I'm not sure when this changed in Python, since the demo script presumably worked with an earlier version. [1]: http://docs.python.org/tutorial/modules.html#the-module-search-path --- demo/python/mmap.py | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/demo/python/mmap.py b/demo/python/mmap.py index 786f8eb..ebab9d7 100755 --- a/demo/python/mmap.py +++ b/demo/python/mmap.py @@ -18,9 +18,12 @@ #set the paths so python can find the comedi module -import sys, os, string, struct, time, mmap, array -sys.path.append('./build/lib.linux-i586-2.1') +import sys, os, string, struct, time, array + +sys.path.append(sys.path.pop(0)) +import mmap +sys.path.append('./build/lib.linux-i586-2.1') import comedi as c #open a comedi device -- 2.26.2