Changeset 1473 for trunk/bindings/python
- Timestamp:
- 09/05/10 14:28:15 (21 months ago)
- File:
-
- 1 edited
-
trunk/bindings/python/nxs/napi.py (modified) (5 diffs)
Legend:
- Unmodified
- Added
- Removed
-
trunk/bindings/python/nxs/napi.py
r1461 r1473 14 14 looks in the following places in order:: 15 15 16 os.environ['NEXUSLIB'] - All 17 directory containing nxs.py - All 18 os.environ['NEXUSDIR']\bin - Windows 19 os.environ['LD_LIBRARY_PATH'] - Unix 20 os.environ['DYLD_LIBRARY_PATH'] - Darwin 21 PREFIX/lib - Unix and Darwin 22 /usr/local/lib - Unix and Darwin 23 /usr/lib - Unix and Darwin 24 25 On Windows it looks for one of libNeXus.dll or libNeXus-0.dll. 26 On OS X it looks for libNeXus.dylib 27 On Unix it looks for libNeXus.so 28 NEXUSDIR defaults to r'C:\Program Files\NeXus Data Format'. 29 PREFIX defaults to /usr/local, but is replaced by the value of 30 --prefix during configure. 16 @verbatim 17 os.environ['NEXUSLIB'] - All 18 directory containing nxs.py - All 19 os.environ['NEXUSDIR']\bin - Windows 20 os.environ['LD_LIBRARY_PATH'] - Unix 21 os.environ['DYLD_LIBRARY_PATH'] - Darwin 22 PREFIX/lib - Unix and Darwin 23 /usr/local/lib - Unix and Darwin 24 /usr/lib - Unix and Darwin 25 @endverbatim 26 27 - On Windows it looks for one of libNeXus.dll or libNeXus-0.dll. 28 - On OS X it looks for libNeXus.dylib 29 - On Unix it looks for libNeXus.so 30 - NEXUSDIR defaults to 'C:\\Program Files\\NeXus Data Format'. 31 - PREFIX defaults to /usr/local, but is replaced by the value of --prefix during configure. 31 32 32 33 The import will raise an OSError exception if the library wasn't found … … 40 41 Example 41 42 ======= 42 43 @code 43 44 import nxs 44 45 file = nxs.open('filename.nxs','rw') … … 47 48 print file.getdata() 48 49 file.close() 49 50 See nxstest.py for a more complete example. 50 @endcode 51 52 See @example nxstest.py for a more complete example. 51 53 52 54 Interface … … 71 73 File open modes can be constants or strings:: 72 74 73 nxs.ACC_READ 'r' 74 nxs.ACC_RDWR 'rw' 75 nxs.ACC_CREATE 'w' 76 nxs.ACC_CREATE4 'w4' 77 nxs.ACC_CREATE5 'w5' 78 nxs.ACC_CREATEXML 'wx' 75 @verbatim 76 nxs.ACC_READ 'r' 77 nxs.ACC_RDWR 'rw' 78 nxs.ACC_CREATE 'w' 79 nxs.ACC_CREATE4 'w4' 80 nxs.ACC_CREATE5 'w5' 81 nxs.ACC_CREATEXML 'wx' 82 @endverbatim 79 83 80 84 Dimension constants:: 81 85 82 nxs.UNLIMITED - for the extensible data dimension83 nxs.MAXRANK - for the number of possible dimensions86 - nxs.UNLIMITED - for the extensible data dimension 87 - nxs.MAXRANK - for the number of possible dimensions 84 88 85 89 Data types are strings corresponding to the numpy data types:: … … 104 108 Miscellaneous constants:: 105 109 106 nxs.MAXNAMELEN - names must be shorter than this107 nxs.MAXPATHLEN - total path length must be shorter than this108 nxs.H4SKIP - class names that may appear in HDF4 files but can be ignored110 - nxs.MAXNAMELEN - names must be shorter than this 111 - nxs.MAXPATHLEN - total path length must be shorter than this 112 - nxs.H4SKIP - class names that may appear in HDF4 files but can be ignored 109 113 110 114 Caveats 111 115 ======= 112 116 113 TODO:NOSTRIP constant is probably not handled properly,114 TODO:Embedded nulls in strings is not supported115 116 WARNING:We have a memory leak. Calling open/close costs about 90k a pair.117 @todo NOSTRIP constant is probably not handled properly, 118 @todo Embedded nulls in strings is not supported 119 120 @warning We have a memory leak. Calling open/close costs about 90k a pair. 117 121 This is an eigenbug: 118 - if I test ctypes on a simple library it does not leak 119 - if I use the leak_test1 code in the nexus distribution it doesn't leak 120 - if I remove the open/close call in the wrapper it doesn't leak. 121 122 .. _NAPI: http://www.nexusformat.org/Application_Program_Interface 122 - if I test ctypes on a simple library it does not leak 123 - if I use the leak_test1 code in the nexus distribution it doesn't leak 124 - if I remove the open/close call in the wrapper it doesn't leak. 125 123 126 """ 127 124 128 __all__ = ['UNLIMITED', 'MAXRANK', 'MAXNAMELEN','MAXPATHLEN','H4SKIP', 125 129 'NeXus','NeXusError','open']
Note: See TracChangeset
for help on using the changeset viewer.
