Non hashable object (without __dict__)

2011-04-20 Thread Arthur Mc Coy
Hello, I have a C++ application, I used SWIG to call the python code. I pass myModule.myObject object to the method of python code and what to store it in JSON format. The problem is when I do: o = myModule.myObject() inside python, the o object has __dict__ property, but if I take the passed

Re: How to get python class serializable and well parsed by JSON

2011-03-11 Thread Arthur Mc Coy
Currently trying to pick up my ava http://en.gravatar.com/christinasanders21 for StackOverflow, which site I found very good for my questions, didn't I? Yes, and there are problem when adding a picture. Web admins should be careful. Can anyone explain me my problem ? : Christina -- http:/

Re: How to get python class serializable and well parsed by JSON

2011-03-11 Thread Arthur Mc Coy
Common guys, help me, sweet heart to finish my job and go with my friend in the bar. Today we have a blues night :) Love it! Christina -- http://mail.python.org/mailman/listinfo/python-list

How to get python class serializable and well parsed by JSON

2011-03-11 Thread Arthur Mc Coy
Hi people, I've created very nice post here: http://stackoverflow.com/questions/5274690/how-to-get-python-class-serializable-and-well-parsed-by-json-custom-encoder-deco Yes, there are solutions over the internet, but nothing works for my custom types. If you could answer, please read it. Be happ

Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
In short, the answer is to use PyObject dictionary ? -- http://mail.python.org/mailman/listinfo/python-list

Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Stephan, you are lead developer over there :))) It's marketing, however very nice solution.. I will propose my bosses to rediscover their world assumptions. You know, they are still using SVN, they are very loosely coupled to the past. I have to wash their brains... Meantime still battling with Py

Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Stefan, great suggestion !! I will definitely bookmark this page and consider later. But my project dictate me use SWIG. I'm almost near the happy subend. Very curios on question I asked in previous message. Dear all, I love you too much :) Arthur -- http://mail.python.org/mailman/listinfo/pyth

Re: python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Ok people, I do: for (Py_ssize_t i = 0; i< PyList_Size(py_list); ++i) { PuObject* obj = PyList_GetItem(py_list, i); if (obj != NULL) { // howto get obj properties of different types (map, list, string, int, bool) ? } } Very clear code. The question i

python data types in c++ code

2011-03-06 Thread Arthur Mc Coy
Hi all, Ok, I managed to work with c++ data types in python and can store serialize c++ objects to store in json. Now the task is backward. I wrote a c++ code to get the list of objects using again python interface. The list of objects is returned. PyList. But I can't see how to convert PyObjec

Re: c++ data types in python script

2011-03-06 Thread Arthur Mc Coy
Great! The solution is to use self.benchmarks = list(object.benchmarks). Now I'm battling with time_t type. C++ time_t converts to python int but it causes memore leaks due to destructor absence. I'm trying to figure it out. If anyone know, please share your thoughts. Be happy :) Arthur -- htt

c++ data types in python script

2011-03-06 Thread Arthur Mc Coy
Hi people, I've used SWIG module to embed python inside c++ app. I pass a list of objects (with lots of different properties of types string, float, custom types like URL, Software and finally of list of strings). Now I'm in python. URL and Software has str() method that converts their value to s

Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Still need the answer to the question: " howto embed given python file (which contains python class and its members) into the c++ application ? " I have to pass the arguments from c++ to python and back so I need to do conversions. They are ok. Fails PyImport_Import(my_module) call saying "No modu

Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Using simple words: I have mymodule.py file and c++ application. mymodule.py file contains two classes A and B. A class is a custom data type. B class contains functions putJSON, getJSON which I want to run from within C++ code. These functions are members of class B. So I need to import mymodule.p

Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
The problem is "how to write python module under SWIG for C++ application" Nor SWIG documentation neither embeding python documentation does not answer to this. If you can help, please, share your idea. Arthur -- http://mail.python.org/mailman/listinfo/python-list

Re: import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
hon? > > ~/santa > > [1] http://docs.python.org/extending/ > > On Fri, Mar 4, 2011 at 8:27 AM, Arthur Mc Coy <1984docmc...@gmail.com>wrote: > >> Hi all, >> >> >> I have a C++ application. I have a .cpp file which is not a main >> program, but a clas

import python module from C++ code

2011-03-04 Thread Arthur Mc Coy
Hi all, I have a C++ application. I have a .cpp file which is not a main program, but a class where I want to call python script (doSomething.py file). I'm using embed python like in a tutorial here: http://www.codeproject.com/KB/cpp/embedpython_1.aspx But the tutorial is bad. It does not expla

Re: python simplejson decoding

2011-03-04 Thread Arthur Mc Coy
Good day people, So I have python file which can handle json data to put and get back it from a file say objects.json. Great. Now I want to run this code from within C++ application. I used swig to wrap the C++ class, which wants to call python code. It works fine, because when I import native p

Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
> Are you saying python cares whether I express a number as 0.001 or > scaled by 10^5 to read 100? If this is the case, I'm still stuck. I > need the full range of eigenvalues from 1 to 1E-300, so the entire > range could be scaled by 1E300 but I would still need better precision > than 1E19 If py

Re: python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
copy nested information. I will see later. Now, when the testing environment is ready, I go for real world application. Thank you! Kostia On Mar 2, 4:24 pm, Peter Otten <__pete...@web.de> wrote: > Arthur Mc Coy wrote: > > Hi all, > > > I'm trying an example (in attach

Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
On Mar 2, 5:26 pm, Ben123 wrote: > On Mar 2, 9:04 am, Arthur Mc Coy <1984docmc...@gmail.com> wrote: > > > What do you mean by "arbitrary precision" ? Each method of calculating > > of something has its own precision... > > If you are unfamiliar with arbi

Re: arbitrary precision linear algebra

2011-03-02 Thread Arthur Mc Coy
What do you mean by "arbitrary precision" ? Each method of calculating of something has its own precision... -- http://mail.python.org/mailman/listinfo/python-list

python simplejson decoding

2011-03-02 Thread Arthur Mc Coy
Hi all, I'm trying an example (in attached file, I mean the bottom of this message). First, I create a list of 3 objects. Then I do: PutJSONObjects(objects) objects = GetJSONObjects() PutJSONObjects(objects, "objects2.json") 1) PutJSONObjects(objects) method creates objects.json file (by de