Message20289
Logged In: YES
user_id=1003784
Hello Martin,
I am attaching the sample program which demonstrates the
issue;
1. I compiled it on Windows 2000 with VC++ compiler.
2. There is a "Extension Module" [flpythonmodulesu(d).dll]
which is used by "Main" program
=========================================
Extension Module (extModule.dsp project)
generates : (*u.* - release, *ud.* - debug)
1. dll _flpythonmodulesud.dll
2. python script flpythonmodulesud.py
------------------------------------------------------
1. Module has class FlPythonString and class Record defined
2. Using interface file include\flpythonmodulesud.i, SWIG-
1.3.19 generates include\flpythonmodulesud_wrap.cxx
===========================================
=========================================
Main sample program (multiSub.dsp project)
generates :
1. executable multiSub.exe
------------------------------------------------------
1. Links in the extension DLL
2. Initializes and De-initializes python in main thread
3. Main thread creates 2 separate threads:
(a) Each thread creating a new sub-interpreter
(b) importing extension module
(c) Calling following EXPRESSION using PyEval_EvalCode(),
Thread 1:
myVar = FlPythonStringPtr(STRObject)
myRecord = myVar.NewRecord()
Thread=str(myVar.Get())
record=str(myRecord.GetValue())
print 'Inside EXPRESSION ' + Thread + ':' +
record;myVar.DeleteRecord(myRecord)
Thread 2:
myVar = FlPythonStringPtr(STRObject)
for recordNum in range(1, 11):
myRecord = myVar.NewRecord()
Thread=str(myVar.Get())
record=str(myRecord.GetValue())
print 'Inside EXPRESSION ' + Thread + ':' +
record;myVar.DeleteRecord(myRecord)
(d) Destroying sub-interpreter.
Comments in the code explain details about each step.
===========================================
==========================================
Console Output messages explanations
(Attaching a sample console output for the issue
[consoleop.txt])
-----------------------------------------------------
-Thread *ID*:IMPORT Module Called:*ITERATION*
-Inside EXPRESSION *Thread*:*Record::GetValue()
[hardcoded to 1000]*
-Thread *ID*:EXPRESSION Done:*ITERATION*
-Thread *ID*:ENDINTERPRETER Called
-Thread *ID*:EXPRESSION Failed!:*ITERATION*
Check the error message demonstrating the issue:
-----------------------------------------------
"Thread 2:EXPRESSION Failed!:3
Traceback (most recent call last):
File "EXPRESSION", line 4, in ?
File "E:\VssLocal\Isis\python23_issue\multiSub\Debug\flpython
modulesud.py", line 69, in Get
def Get(*args): return apply
(_flpythonmodulesud.FlPythonString_Get,args)
File "E:\VssLocal\Isis\python23_issue\multiSub\Debug\flpython
modulesud.py", line 51, in __init__
_swig_setattr(self, Record, 'this', this)
TypeError: 'NoneType' object is not callable"
==========================================
Martin, Thanks for taking a look at the issue which has proved
to be a major hurdle for our release and made us switch back
to Python 2.2.2. Python 2.2.2 in itself has some issues for us;
so if this can get fixed we would desperately be seeking a
patch on Python 2.3.
Let me know if you need any more inputs from my side.
Thanks again,
Atul |
|
Date |
User |
Action |
Args |
2007-08-23 14:20:33 | admin | link | issue921077 messages |
2007-08-23 14:20:33 | admin | create | |
|