Python Scripting Support

Hey All,

After a somewhat busy weekend hacking away at it, Python scripting is
now ready to get bumped into the next level. For now it’s only
available for extensions (no engines in python yet). However, it’s
pretty cool. PyQt integrates VERY nicely so depending on how much of
our API we expose we can do some cool things. Right now it’s pretty
basic. Eventually we can get it where you can customize locations and
maybe dock widgets.

Anyways, everyone should try it out and possibly people who have nice
functionality already could see what we’re doing here. The main thing I
haven’t done is expose all the API we will want exposed. Thus, you will
need to edit ‘libavogadro/src/boost.h’ which is where all our API is
exposed. It’s a little tricky to get used to and documentation is kinda
a headache but I have a pretty good feel for it now so let me know if
you run into any snags. If you want access to something and it’s not
already available, please let me know.

It would be interesting to see if we would be better off going with Swig
for some of this stuff since that’s what OpenBabel is written in. The
only reason I bring it up is because anything that’s already exposed to
python (such as OpenBabel) is easily integrated in new things that
utilize subclasses of that. There is no reason that Avogadro should
expose parts of the Openbabel API that’s already there but this whole
Python/C thing is messy to me. (i rely on a lot of boost.python magic).
I also don’t like that boost.python makes us have to use exceptions.
Now that I have better grasp on the whole Python API thing I may go back
and do some hacking with SWIG. We’ll see.


Donald

Moin

With the new Python-support I am hitting this issue:

After a somewhat busy weekend hacking away at it, Python scripting is
now ready to get bumped into the next level. For now it’s only
available for extensions (no engines in python yet).

/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp: In
member function ‘boost::python::api::object
Avogadro::PythonInterpreter::execWrapper(const QString&,
boost::python::api::object, boost::python::api::object)’:
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp:86:
error: ‘exec’ is not a member of ‘boost::python’
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp: In
member function ‘boost::python::api::object
Avogadro::PythonInterpreter::evalWrapper(const QString&,
boost::python::api::object, boost::python::api::object)’:
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp:100:
error: ‘eval’ is not a member of ‘boost::python’
[ 2%] Building CXX object libavogadro/src/CMakeFiles/avogadro-lib.dir/color.o
/usr/bin/c++ -Davogadro_lib_EXPORTS -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-check-new -fno-common -fPIC -I/usr/include/QtOpenGL -I/usr/include/QtGui -I/usr/include/QtCore -I/home/kde-devel/kde/src/avo-git/libavogadro/include -I/home/kde-devel/kde/src/avo-git -I/home/kde-devel/kde/build/avo-git/libavogadro/src -I/home/kde-devel/kde/build/avo-git/libavogadro/src/… -I/home/kde-devel/kde/build/include/openbabel-2.0 -I/usr/include/python2.5 -D_BSD_SOURCE -DQT_SHARED -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -o
libavogadro/src/CMakeFiles/avogadro-lib.dir/color.o -c /home/kde-devel/kde/src/avo-git/libavogadro/src/color.cpp
make[2]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/pythoninterpreter.o]
Error 1
make[2]: *** Waiting for unfinished jobs…

Carsten

Moin again

Perhaps my issue is related to the missing PythonBoost-cmake magic? Donald,
you are using find_package(Boost) which probably comes with CMake itself?
Attached is the FindBoostPython.cmake used in kdeedu. Perhaps this helps?

Carsten

Hrm, it is possible I’m using a newer Boost.Python API and we have not
correctly set the version checking. I am running boost 1.34 and I also
ran this code on Ubuntu (the latest release). The command is obviously
"exec" that it is missing and I’m not sure what version that was
introduced.

To be honest, I’ve noted all of the changes to the Boost.Python stuff
that people have done but I’ve had no time to sit down and sort through
it (including the new cmake file). I will attempt to take a look at
this during the upcoming weekend when I have a bit of breathing room.


Donald

(Sun, Apr 06, 2008 at 05:50:56PM +0200) Carsten Niehaus cniehaus@gmx.de:

Moin

With the new Python-support I am hitting this issue:

After a somewhat busy weekend hacking away at it, Python scripting is
now ready to get bumped into the next level. For now it’s only
available for extensions (no engines in python yet).

/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp: In
member function ‘boost::python::api::object
Avogadro::PythonInterpreter::execWrapper(const QString&,
boost::python::api::object, boost::python::api::object)’:
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp:86:
error: ‘exec’ is not a member of ‘boost::python’
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp: In
member function ‘boost::python::api::object
Avogadro::PythonInterpreter::evalWrapper(const QString&,
boost::python::api::object, boost::python::api::object)’:
/home/kde-devel/kde/src/avo-git/libavogadro/src/pythoninterpreter.cpp:100:
error: ‘eval’ is not a member of ‘boost::python’
[ 2%] Building CXX object libavogadro/src/CMakeFiles/avogadro-lib.dir/color.o
/usr/bin/c++ -Davogadro_lib_EXPORTS -Wnon-virtual-dtor -Wno-long-long -ansi -Wundef -Wcast-align -Wchar-subscripts -Wall -W -Wpointer-arith -Wformat-security -fno-check-new -fno-common -fPIC -I/usr/include/QtOpenGL -I/usr/include/QtGui -I/usr/include/QtCore -I/home/kde-devel/kde/src/avo-git/libavogadro/include -I/home/kde-devel/kde/src/avo-git -I/home/kde-devel/kde/build/avo-git/libavogadro/src -I/home/kde-devel/kde/build/avo-git/libavogadro/src/… -I/home/kde-devel/kde/build/include/openbabel-2.0 -I/usr/include/python2.5 -D_BSD_SOURCE -DQT_SHARED -DQT_OPENGL_LIB -DQT_GUI_LIB -DQT_CORE_LIB -o
libavogadro/src/CMakeFiles/avogadro-lib.dir/color.o -c /home/kde-devel/kde/src/avo-git/libavogadro/src/color.cpp
make[2]: *** [libavogadro/src/CMakeFiles/avogadro-lib.dir/pythoninterpreter.o]
Error 1
make[2]: *** Waiting for unfinished jobs…

Carsten


This SF.net email is sponsored by the 2008 JavaOne(SM) Conference
Register now and save $200. Hurry, offer ends at 11:59 p.m.,
Monday, April 7! Use priority code J8TLD2.
http://ad.doubleclick.net/clk;198757673;13503038;p?http://java.sun.com/javaone


Avogadro-devel mailing list
Avogadro-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/avogadro-devel

Am Dienstag, 8. April 2008 17:25:46 schrieben Sie:

Hrm, it is possible I’m using a newer Boost.Python API and we have not
correctly set the version checking. I am running boost 1.34 and I also
ran this code on Ubuntu (the latest release). The command is obviously
"exec" that it is missing and I’m not sure what version that was
introduced.

Yes, that is most likely the problem. I am running Boost 1.33.1-108.

Carsten