Re: PyRun_SimpleFile() crashes

2008-09-24 Thread lixinyi . 23
On 9月25日, 午前1:05, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 24, 6:30 am, Nick Craig-Wood <[EMAIL PROTECTED]> wrote: > > > > > [EMAIL PROTECTED] <[EMAIL PROTECTED]> wrote: > > > my code: > > > main.cpp > > > #include > > > > int main(int argc, char **argv) > > > { > > >

Re: PyRun_SimpleFile() crashes

2008-09-24 Thread lixinyi . 23
On 9月24日, 午後3:39, [EMAIL PROTECTED] wrote: > my code: > main.cpp > #include > > int main(int argc, char **argv) > { > Py_Initialize(); > > FILE *file_1 = fopen("a2l_reader.py","r+"); > PyRun_SimpleFile(file_1,"a2l_reader.py"); > > Py_Finalize(); > > } > > compile under windows using MinGW: > g++ m

PyRun_SimpleFile() crashes

2008-09-23 Thread lixinyi . 23
my code: main.cpp #include int main(int argc, char **argv) { Py_Initialize(); FILE *file_1 = fopen("a2l_reader.py","r+"); PyRun_SimpleFile(file_1,"a2l_reader.py"); Py_Finalize(); } compile under windows using MinGW: g++ main.cpp libpython25.a -o a no error was found. But when I run a.exe the

Re: How do I use python object in C++

2008-09-23 Thread lixinyi . 23
On 9月24日, 午後1:15, "Aaron \"Castironpi\" Brady" <[EMAIL PROTECTED]> wrote: > On Sep 23, 11:06 pm, "Aaron \"Castironpi\" Brady" > > > > <[EMAIL PROTECTED]> wrote: > > On Sep 23, 9:30 pm, [EMAIL PROTECTED] wrote: > > > > If the PyObject is a PyList, and all list items are strings, > > > say a=['aaa','

Re: How do I use python object in C++

2008-09-23 Thread lixinyi . 23
If the PyObject is a PyList, and all list items are strings, say a=['aaa','bbb','ccc'] How can I have a myArray[0] = "aaa" myArray[1] = "bbb" myArray[2] = "ccc" in C++? Do I have to use PyModule_GetDict() to get the dict first? what about the next? > > What do you know about the contents of 'ar

How do I use python object in C++

2008-09-23 Thread lixinyi . 23
for example I have the following code: #include void exec_pythoncode( int arg, char**argv ) { Py_Initialize(); Py_Main(argc,argv); Py_Finalize(); } What I would like to know is how can I get the variables I want after Py_Main(argc,argv) say I have a=[1,2,'Hello World',0.1234] in th

How can I use a PyObject in C++?

2008-09-23 Thread lixinyi . 23
for example: #include void exec_python_code(int arg, char** argv) { Py_Initialize(); Py_Main(argc,argv); Py_Finalize(); } What I would like to know is: after Py_Main(argc,argv); How do I get every variable in python space, say a=[1,2,3,'Hello World',[2,3]] b=['xx','xxx','',0.12

How do I convert a PyObject to string in C++?

2008-09-22 Thread lixinyi . 23
I have a PyObject, say 'Hello World' , a string, How do I convert it to a string in C++? Thanks in advance! -- http://mail.python.org/mailman/listinfo/python-list

How to get all the variables in a python shell

2008-05-28 Thread lixinyi . 23
Hi! I'm currently working on a scientific computation software built in python. What I want to implement is a Matlab style command window <-> workspace interaction. For example, you type 'a=1' in the command window, and you see a list item named 'a' in the workspace. You double click the icon of