[Nexus] Nexus with python on windows
Darren Dale
darren.dale at cornell.edu
Tue Nov 20 14:34:38 GMT 2007
On Tuesday 20 November 2007 03:08:26 am Jon Wright wrote:
> Darren Dale wrote:
> > 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)
> >
> > Where did you get nxpython_test.nxs? It is not included in the 4.1.0
> > tarball, nor in my svn checkout. I can import nxpython in the python
> > interpretter, but when I tried running nxpython_test.py I got a seg
> > fault, maybe because it is trying to access a nonexistent file.
> >
> > Darren
>
> I'd guess the nxpython.NXACC_CREATE means "make a new file"? For your
> segfault try running your python under gdb (not a debug build, just what
> you already have).
I tried building with debug enabled, and got the same response...
> When it bombs you usually still get a stacktrace
> which tells you which .so (or dll) to blame.
The problem seems to be that I built nexus with support for hdf5 only, and
therefore NXACC_CREATE5 should be used instead of NXACC_CREATE. Once I do
that, I can open a file and I get the same "TypeError: in
method 'nx_putattr', argument 3 of type 'void *'" message as you.
> PyTables looks ever more attractive I guess.
One limitation of swig is the lack of docstrings. It would be really nice to
have a pythonic object-oriented interface, preferrably built around the swig
wrappers but maybe around pytables, with informative docstrings. I might look
into this, if others think it would be useful/helpful to the larger
community.
Darren
More information about the NeXus
mailing list