Is python memory shared between theads?

2006-12-01 Thread Wesley Henwood
So I declare a variable named A in thread1, in script1.py. I assign the value of 2.5 to A. I then run script2.py in thread2. Script2.py assigns the value of 5.5 to a variable named A. Now, when thread1 resums execution, I see that A = 5.5, rather than 2.5 as I expected. Is this normal behavior

Re: stderr, stdout, and errno 24

2006-07-13 Thread Wesley Henwood
I've checked and double checked my code and I am closing all files explicitly after opening them. The only possibliy I can think of is Python opening files each time I run a script, or each time imput to stderr or stdout is redirected. Here's a link that is perhaps related to my problem:

stderr, stdout, and errno 24

2006-07-12 Thread Wesley Henwood
To capture output from python scripts run from a C++ app I've added the following code at the beggening of the C++ app: PyRun_SimpleString("import grabber"); PyRun_SimpleString("import sys"); PyRun_SimpleString("class a:\n\tdef write(self,s):\n\t\tograbber.grab(s)\n"); PyRun_SimpleString("import s

import chains

2006-06-27 Thread Wesley Henwood
I have a program which uses a combination of MFC multithreading, python multithreading, and extended and embedded python. This works: >From the C++ app, call python script A within a MFC thread. Script A imports module 2 which imports module 3. Module 3 is a c++ extension, the code for which is

Re: python commmand line params from c++

2005-06-30 Thread Wesley Henwood
Thanks Denis. PySys_SetArgv should do the trick. The nested function calls are there because the FILE structrure produced by fopen is not always compatible with the FILE structure produced by the Python C++ functions. Something do with the Python C being built with different version ofthe c run-

Re: python commmand line params from c++

2005-06-30 Thread Wesley Henwood
Thanks Denis. PySys_SetArgv should do the trick. The nested function calls are there because the FILE structrure produced by fopen is not always compatible with the FILE structure produced by the Python C++ functions. Something do with the Python C being built with different version ofthe c run-

python commmand line params from c++

2005-06-30 Thread Wesley Henwood
What is the proper way to pass command line parameters to a python script called from C++? I'm tryng this: path = "c:\\someDir\\someScript.py param1 param2 param3"; PyRun_SimpleFile(PyFile_AsFile( PyFile_FromString( path, "r")), "someScript.py"); I'm getting a "format error someScript.py, line 1"