From: W. Trevor King Date: Tue, 13 Mar 2012 13:12:41 +0000 (-0400) Subject: Adjust `sys.path` before importing `mmap` in `demo/python/mmap.py`. X-Git-Url: http://git.tremily.us/?a=commitdiff_plain;h=8add63faa3b2cf2cbae18345f3caf21fdded234c;p=comedilib.git 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 --- 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