[Nexus] Nexus with python on windows

Akeroyd, FA (Freddie) F.A.Akeroyd at rl.ac.uk
Mon Feb 11 12:03:39 GMT 2008


> Hmm... clearly not an expert, I lost that fight. Freddie did compile
the 
> python bindings for us a while back. Having gotten the executables I 
> tried again just now and am not able to get past the testcase which 
> comes with them:

  >>> import nxpython
  >>> h = nxpython.nx_open("nxpython_test.nxs", nxpython.NXACC_CREATE)
  >>> type(h)
  <type 'PySwigObject'>
  >>> help(h)
  [...]
  >>> help(nxpython)
  [...]
  >>> for i in dir(nxpython):print type(getattr(nxpython,i)),i
  [...]
  # start of C example:
  >>> nxpython.nx_putattr (h , "user_name", "Joe Bloggs")
  Traceback (most recent call last):
    File "<stdin>", line 1, in ?
  TypeError: in method 'nx_putattr', argument 3 of type 'void *'

Jon,

The swig python bindings use a dataset abstraction which makes their
usage slightly different from the C NeXus API. There is some general
documentation and TCL language based examples available which seem to
have got left out of the install kits - these are now in the latest 4.1
branch kits at 

http://download.nexusformat.org/kits/snapshots.shtml

and I've also put them in the Windows python additions directory

http://download.nexusformat.org/kits/windows/python/

Regards,

Freddie




More information about the NeXus mailing list