[Nexus] Nexus with python on windows

Peterson, Peter F. petersonpf at ornl.gov
Tue Nov 20 19:22:24 GMT 2007


Darren,

I'm happy to see more people using NeXus.

At the last NIAC meeting I volunteered to hand write a binding to the
C-NAPI and attach to numpy (in python 2.5). Unfortunately, since that
time I have been extremely busy and have not had a chance to start
digging into the code. 

PyTables looks like an interesting package for interacting with HDF5
files. However, the committee feels as though language bindings should
attach directly to the C-NAPI to allow for easier maintenance. I have
seen similar efforts (can recall who) of people using IDL's HDF5
bindings to write NeXus files. They ended up putting a thin layer
between to make sure that the resulting files were readable by the NeXus
API. 

P^2

-----Original Message-----
From: nexus-bounces at nexusformat.org
[mailto:nexus-bounces at nexusformat.org] On Behalf Of Darren Dale
Sent: Tuesday, November 20, 2007 10:30 AM
To: nexus at nexusformat.org
Subject: Re: [Nexus] Nexus with python on windows

On Monday 19 November 2007 04:13:33 pm Jon Wright wrote:
> Hi Darren, Andy;
>
> There is a nice video introduction to PyTables at:
>
> http://www.carabos.com/videos/pytables-1-intro
>
> I'd be curious as to how hard it is to write a Nexus compliant hdf
file
> using PyTables.
>
>  > I know he has grappled with Python and Nexus in the past
>
> 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 *'
>
> Any suggestions?
[...]
> Wrapping  func(..., void *p, size_of_p, type_of_p)  is likely to be
> interesting.

I don't have much experience with C/C++ or swig, but this seems like it
might 
be relevant if it is still applicable, from 
http://www.swig.org/papers/PyTutorial97/PyTutorial97.pdf:

"SWIG does not support pointers to C++ member functions. This is because
such 
pointers can not be properly cast to a pointer of type 'void *' (the
type 
that SWIG uses internally)"

Also this: http://www.swig.org/Doc1.3/SWIGPlus.html#SWIGPlus_nn21

Darren
_______________________________________________
NeXus mailing list
NeXus at nexusformat.org
http://lists.nexusformat.org/mailman/listinfo/nexus



More information about the NeXus mailing list