473,395 Members | 1,442 Online
Bytes | Software Development & Data Engineering Community
Post Job

Home Posts Topics Members FAQ

Join Bytes to post your question to a community of 473,395 software developers and data experts.

a strange problem in python multi-thread programming

Today,I found a strange problem in python multi-thread programming.When I used function win32com.client.Dispatch('ADODB.Connection') in primary thread, it was OK. But when I called it in secondary-thread, it raised a exception. Then debugging and tracking the code, I found the problem was from the function pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) in . The parameters are (ADODB.Connection, None, 21, {00020400-0000-0000-C000-000000000046}). But just as I said above, this function would be ok in primaray thread mode but not work in the secondary-thread mode. Since this function is from the dll(in my computer is python23.dll), I can not see the source code and don't know how to solve this problem. Anyone can help me?
Jul 18 '05 #1
1 2290
> Today,I found a strange problem in python multi-thread programming.When I
used function win32com.client.Dispatch('ADODB.Connection') in primary
thread, it was OK. But when I called it in secondary-thread, it raised a
exception. Then debugging and tracking the code, I found the problem was
from the function pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch) in . The parameters are (ADODB.Connection, None,
21, {00020400-0000-0000-C000-000000000046}). But just as I said above,
this function would be ok in primaray thread mode but not work in the
secondary-thread mode. Since this function is from the dll(in my computer
is python23.dll), I can not see the source code and don't know how to
solve this problem. Anyone can help me?


It has been years since I dealed with COM the last time - so I'm sort of on
the speculative side here. However I remember that there were different
com-server-models your com-objects could support. They dealt with
in/out-processes and threading. So might it be that your ADODB.Connection
is not supposed to be called in a multi-threaded environment?

--
Regards,

Diez B. Roggisch
Jul 18 '05 #2

This thread has been closed and replies have been disabled. Please start a new discussion.

Similar topics

1
by: a_bogdan_marinescu | last post by:
Hello all, I'm trying to do some COM automation from Python (using Mark Hammond's Win32 extensions, of course) and I'm getting some very strange errors. Specifically, I try to use a COM object...
1
by: Gernot Hillier | last post by:
-----BEGIN PGP SIGNED MESSAGE----- Hash: SHA1 Hi! I'm the developer of a Linux ISDN application which uses embedded Python for controlling the communication. It starts several threads (i.e....
0
by: Derek Thomson | last post by:
Hi, I frequently have to debug some fairly tricky Python multi-threaded code, and I need some help using the debugger to help me diagnose the problems when they occur. Yes, I know that the best...
0
by: Hai Ly Hoang | last post by:
Hi, I'm using VC++ 7.0 (VS 2003). My code: void main() { int *a = new int; } I'm sure that the above code is accepted by VC++ (no compiling error). What is exactly the semantic of the above...
5
by: Chris Smith | last post by:
Hi, I've been working on some multi-dimensional lists and I've encountered some very strange behaviour in what appears to be simple code, I'm using python 2.4.2 and IDLE. If anyone can tell me...
10
by: Rocco | last post by:
hi I made the upgrade to python 2.4.3 from 2.4.2. I want to take from google news some atom feeds with a funtion like this import urllib2 def takefeed(url): request=urllib2.Request(url)...
2
by: Jeff Rush | last post by:
Forrester Research is doing a study on dynamic languages and has asked that Python be represented. As advocacy coordinator I've volunteered to drive this, collecting answers from the community and...
2
by: askalottaqs | last post by:
To make the q simple: i want to access inner array elements by the names of the inner arrays. thanks here's a more complex explanation: I have those arrays: animatorsNames = jun = ...
5
by: =?GB2312?B?zPC5zw==?= | last post by:
Howdy everyone, I saw a strange python code in pygame project. What does "while not(x&528or x in l):" mean? Below code works in python2.5, so "x&528" is not HTML strings. # snake.py code:...
0
by: Alexandru Palade | last post by:
Nothing strange about that syntax (though some spaces might helped you out). The '&' operator is a bit-wise operator (http://docs.python.org/ref/bitwise.html). 甜瓜 wrote:
0
by: Charles Arthur | last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
0
by: ryjfgjl | last post by:
If we have dozens or hundreds of excel to import into the database, if we use the excel import function provided by database editors such as navicat, it will be extremely tedious and time-consuming...
0
BarryA
by: BarryA | last post by:
What are the essential steps and strategies outlined in the Data Structures and Algorithms (DSA) roadmap for aspiring data scientists? How can individuals effectively utilize this roadmap to progress...
1
by: Sonnysonu | last post by:
This is the data of csv file 1 2 3 1 2 3 1 2 3 1 2 3 2 3 2 3 3 the lengths should be different i have to store the data by column-wise with in the specific length. suppose the i have to...
0
by: Hystou | last post by:
There are some requirements for setting up RAID: 1. The motherboard and BIOS support RAID configuration. 2. The motherboard has 2 or more available SATA protocol SSD/HDD slots (including MSATA, M.2...
0
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can...
0
Oralloy
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers,...
0
jinu1996
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven...
0
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.