Thanks for the answer, but I should add that I am using Windows 7 32Bit
with Python 2.6.
Ronny
Am 7/20/2012 5:19 PM, schrieb Ralf Grosse-Kunstleve:
without having looked at your code ...
most likely this is a memory issue. run with valgrind (valgrind.org
<http://valgrind.org> or man valgrind) to pin-point the problem.
On Fri, Jul 20, 2012 at 7:55 AM, Ronny Herzog <her...@mpi-cbg.de
<mailto:her...@mpi-cbg.de>> wrote:
Dear all,
I want to export a boost::python::dict containing a
boost::python::list. However, when I print this list in Python, I
get an unlimited output of some strange numbers:
namespace bp = boost::python;
class readraw
{
....
bp::list mk_pyPeak_list()
{
bp::list py_peak_list;
for (int i = 0; i < peak_number; i++)
{
py_peak_list.append(bp::make___tuple(peak_list[0][i].mz,
peak_list[0][i].intensity));
}
return py_peak_list;
}
bp::dict peak_list_info()
{
bp::dict info;
//bp::object pn = peak_number;
//info["peakNumber"] = peak_number;
//std::cout <<
bp::extract<int>(mk_pyPeak___list().attr("__len__")();
bp::list l(mk_pyPeak_list());
info["peakList"] = l;
return info;
}
};
BOOST_PYTHON_MODULE(readraw)
{
bp::class_<readraw>("readraw", bp::init<int>())
.def("add_peak", &readraw::add_peak)
.def("peak_list_info", &readraw::peak_list_info)
.def("average_scans", &readraw::average_scans)
;
In Python:
>>> print rawfilereader.peak_list_info()
Results in smth. like:
...
(-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925e+66),
(-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925e+66
), (-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925e+66),
(-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925e+
66), (-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925e+66),
(-431602080.0 <tel:%28-431602080.0>, -6.2774385622041925
e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.2774385622041925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.27743856220419
25e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.2774385622041925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.277438562204
1925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.2774385622041925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.2774385622
041925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.2774385622041925e+66), (-431602080.0 <tel:%28-431602080.0>,
-6.27743856
...
What am I doing wrong?
Thanks for the help,
Ronny
_________________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org <mailto:Cplusplus-sig@python.org>
http://mail.python.org/__mailman/listinfo/cplusplus-sig
<http://mail.python.org/mailman/listinfo/cplusplus-sig>
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig
_______________________________________________
Cplusplus-sig mailing list
Cplusplus-sig@python.org
http://mail.python.org/mailman/listinfo/cplusplus-sig