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
This commit is contained in:
W. Trevor King 2012-03-13 09:12:41 -04:00
parent 7a277ab0cb
commit 8add63faa3

View file

@ -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