Commit graph

7 commits

Author SHA1 Message Date
Ian Abbott
ac090c7bdf demo/python/mmap.py: Fix buffer wraparound bug.
Fix bug reported by Ross Williamson where the code does not deal with
buffer wraparound within a chunk of data.
2012-05-10 13:49:57 +01:00
W. Trevor King
db4fd99309 Suggest people use PYTHONPATH rather than adjusting sys.path internally.
The old method only worked out of the box if you were running Python
2.1 on a 586.  I imagine that is too small a slice of current users to
be worth hard coding ;).
2012-03-13 09:30:45 -04:00
W. Trevor King
55b6a03a50 Add myself to the old Python demo copyrights, since I just tweaked each demo. 2012-03-13 09:24:07 -04:00
W. Trevor King
3d79204427 Cast the period to an integer in demo/python/mmap.py's command setup.
This avoids:

   Traceback (most recent call last):
     ...
     File ".../mmap.py", line 96, in prepare_cmd
       C.scan_begin_arg = 1e9/freq
     ...
   TypeError: in method 'comedi_cmd_struct_scan_begin_arg_set',
      argument 2 of type 'unsigned int'
2012-03-13 09:17:08 -04:00
W. Trevor King
8add63faa3 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
2012-03-13 09:12:41 -04:00
David Schleef
bd414e5a57 add #! line 2003-06-04 02:54:41 +00:00
David Schleef
cbc88ac621 Add python examples from Luc Lefebvre <luc.lefebvre@mcgill.ca> 2003-06-04 02:53:45 +00:00