| Crispen 2005-05-31, 9:14 am |
| I am tring to automate controldesk using python. But when i try to run
the control desk automation libraries in a thread the following error
comes up:
[color=darkred]
Traceback (most recent call last):
File "c:\Users\Crispen Berg\diet_triggering_test_Testing\Matlab
Files\_triggering.py", line 153, in Auto
Instrumentation().ConnectionController.DisableSystemPoll()
File
"C:/dSPACE/Common/Python22/Modules/AutomationLibs/cdautomationlib.py",
line 79, in __init__
File
"C:/dSPACE/Common/Python22/Modules/AutomationLibs/controldesk.py", line
306, in __init__
pywintypes.com_error: (-2147221008, 'CoInitialize has not been
called.', None, None)
The code that produces the error is:
[color=darkred]
import cdacon
from cdautomationlib import *
def
On_Instrumentation_triggering_dSPACEPush
ButtonControl_1_ButtonDown(OrderIndex):
thread.start_new_thread(Auto,())
def Auto():
sleep(0.2)
# triggering://dSPACE NumericInput Control_1:WriteData
Instrumentation().ConnectionController.DisableSystemPoll()
Instrumentation().Layouts.Item("c:\\users\\\\matlab
files\\triggering.lay").Instruments.Item("dSPACE NumericInput
Control_1").Value = 1.0000000000000000
Instrumentation().ConnectionController.ProcessAnimationEvent("triggering://dSPACE
NumericInput Control_1","WriteData")
Instrumentation().ConnectionController.EnableSystemPoll()
sleep(0.2)
# triggering://dSPACE NumericInput Control_1:WriteData
Instrumentation().ConnectionController.DisableSystemPoll()
Instrumentation().Layouts.Item("c:\\users\\matlab
files\\triggering.lay").Instruments.Item("dSPACE NumericInput
Control_1").Value = 0.00000000000000000
Instrumentation().ConnectionController.ProcessAnimationEvent("triggering://dSPACE
NumericInput Control_1","WriteData")
Instrumentation().ConnectionController.EnableSystemPoll()
sleep(0.2)
# triggering://dSPACE NumericInput Control:WriteData
Instrumentation().ConnectionController.DisableSystemPoll()
Instrumentation().Layouts.Item("c:\\users\\matlab
files\\triggering.lay").Instruments.Item("dSPACE NumericInput
Control").Value = 1.0000000000000000
Instrumentation().ConnectionController.ProcessAnimationEvent("triggering://dSPACE
NumericInput Control","WriteData")
Instrumentation().ConnectionController.EnableSystemPoll()
sleep(0.2)
# triggering://dSPACE NumericInput Control:WriteData
Instrumentation().ConnectionController.DisableSystemPoll()
sleep(0.2)
Instrumentation().Layouts.Item("c:\\users\\ matlab
files\\triggering.lay").Instruments.Item("dSPACE NumericInput
Control").Value = 0.00000000000000000
Instrumentation().ConnectionController.ProcessAnimationEvent("triggering://dSPACE
NumericInput Control","WriteData")
Instrumentation().ConnectionController.EnableSystemPoll()
sleep(0.2)
Instrumentation().Layouts.Item("c:\\users\\matlab
files\\triggering.lay").Activate()
sleep(0.2)
Instrumentation().Layouts.Item("c:\\users\\matlab
files\\triggering.lay").Activate()
If any body could that would be great
Yours Sincerely
Crispen Berg
|