hi,
i'm using python 2.4 with pywin32...
I've tried to use internet explorer control with a class.
it was fine until i decided to inherit thread for the class...
class domain01(threading.Thread):
def __init__(self):
#blabla
threading.Thread.__init__(self)
def run(self):
self.ie = win32com.client.Dispatch('InternetExplorer.Applica tion.1')
#this line gives error if i use .start(), but if i use .run.. no error...
self.ie.Visibble = 1
print "running"
xyz = domain()
xyz.start()
===========
this is what i get:
Exception in thread Thread-23:
Traceback (most recent call last):
File "C:\Python24\lib\threading.py", line 442, in __bootstrap
self.run()
File "C:\python2exe\domain01.py", line 41, in run
self.dologin()
File "C:\python2exe\domain01.py", line 56, in dologin
self.ie=win32com.client.Dispatch('InternetExplorer .Application.1')
File "C:\Python24\Lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx)
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line
91, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line
79, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221008, 'CoInitialize has not been called.', None, None)
=====
but if i run:
xyz = domain()
xyz.run()
##no error! it's weird....
anyone know how to solve this problem?
thank you :)
best regards,
James 2 3066
You'll need to call pythoncom.CoInitialize() in each thread.
Roger
"James" <c0******@gmail.com> wrote in message
news:41********@news.tm.net.my... hi,
i'm using python 2.4 with pywin32... I've tried to use internet explorer control with a class. it was fine until i decided to inherit thread for the class...
class domain01(threading.Thread): def __init__(self): #blabla threading.Thread.__init__(self)
def run(self): self.ie = win32com.client.Dispatch('InternetExplorer.Applica tion.1') #this line gives error if i use .start(), but if i use .run.. no error... self.ie.Visibble = 1 print "running" xyz = domain() xyz.start()
=========== this is what i get: Exception in thread Thread-23: Traceback (most recent call last): File "C:\Python24\lib\threading.py", line 442, in __bootstrap self.run() File "C:\python2exe\domain01.py", line 41, in run self.dologin() File "C:\python2exe\domain01.py", line 56, in dologin self.ie=win32com.client.Dispatch('InternetExplorer .Application.1') File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 79, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221008, 'CoInitialize has not been called.', None, None) ===== but if i run: xyz = domain() xyz.run()
##no error! it's weird....
anyone know how to solve this problem?
thank you :)
best regards,
James
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups
---= East/West-Coast Server Farms - Total Privacy via Encryption =---
thannnnk you Roger :)
thank you so much :)
best regards,
James
Roger Upole wrote: You'll need to call pythoncom.CoInitialize() in each thread.
Roger
"James" <c0******@gmail.com> wrote in message news:41********@news.tm.net.my...
hi,
i'm using python 2.4 with pywin32... I've tried to use internet explorer control with a class. it was fine until i decided to inherit thread for the class...
class domain01(threading.Thread): def __init__(self): #blabla threading.Thread.__init__(self)
def run(self): self.ie = win32com.client.Dispatch('InternetExplorer.Applica tion.1') #this line gives error if i use .start(), but if i use .run.. no error... self.ie.Visibble = 1 print "running" xyz = domain() xyz.start()
=========== this is what i get: Exception in thread Thread-23: Traceback (most recent call last): File "C:\Python24\lib\threading.py", line 442, in __bootstrap self.run() File "C:\python2exe\domain01.py", line 41, in run self.dologin() File "C:\python2exe\domain01.py", line 56, in dologin self.ie=win32com.client.Dispatch('InternetExplorer .Application.1') File "C:\Python24\Lib\site-packages\win32com\client\__init__.py", line 95, in Dispatch dispatch, userName = dynamic._GetGoodDispatchAndUserName(dispatch,use rName,clsctx) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 91, in _GetGoodDispatchAndUserName return (_GetGoodDispatch(IDispatch, clsctx), userName) File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 79, in _GetGoodDispatch IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx, pythoncom.IID_IDispatch) com_error: (-2147221008, 'CoInitialize has not been called.', None, None) ===== but if i run: xyz = domain() xyz.run()
##no error! it's weird....
anyone know how to solve this problem?
thank you :)
best regards,
James
----== Posted via Newsfeeds.Com - Unlimited-Uncensored-Secure Usenet News==---- http://www.newsfeeds.com The #1 Newsgroup Service in the World! >100,000 Newsgroups ---= East/West-Coast Server Farms - Total Privacy via Encryption =--- This thread has been closed and replies have been disabled. Please start a new discussion. Similar topics
by: Raymond H. |
last post by:
Hello,
I create a vb4 project which can also naviger on Internet via the
WebBrowser control which I put on my form.
My question is: if this program is installed on a station having already...
|
by: SunshineGirl |
last post by:
I'm trying to receive events from a running instance of Internet Explorer.
So far I've only been able to receive events from an instance I launch from
code, but I need to receive events from all...
|
by: CathieC |
last post by:
I have a websote developed using visual studio 2005 beta , .net version 2
i deploy my application to a server and it is run from client computers.
One of the users gets the error
"Internet...
|
by: VK |
last post by:
Internet Explorer 7 beta 2 preview
CNET Editor review:
<http://reviews.cnet.com/Internet_Explorer_7_for_XP_SP2_Beta_2/4505-3514_7-31454661-2.html?tag=nl.e415>
Summary (my personal review...
|
by: Wendy |
last post by:
Hello,
I have a program that does the following:
When a user clicks on a row in a VB.NET datagrid, it will open a web page in
Internet Explorer (that corresponds to that item in the selected row...
|
by: laredotornado |
last post by:
Hi,
This problem only affects PC IE. On a secured page (a page visited via
https), there is a link that reads -- "Download HTML File". The link
connects to this page
<?php...
|
by: mwallis76 |
last post by:
Upon clicking on a hyperlink generated in a ASP.NET GridView control,
I am finding Firefox 1.5 to crash. However, when clicking on the same
link, Internet Explorer 6.0 works just fine and is...
|
by: Etayki |
last post by:
Hi!
I am new to VB.net and I am using the Visual Basic 2005 Express
Edition
I have two questions:
1. I am trying to write an application that will automate Internet
Explorer and store data...
|
by: -Lost |
last post by:
This is more of a post to inform, unless of course I am missing
something fundamental, in which case I would appreciate anyone
explaining it.
Based on Mr. Michaux's camelizeStyle function I...
|
by: taylorcarr |
last post by:
A Canon printer is a smart device known for being advanced, efficient, and reliable. It is designed for home, office, and hybrid workspace use and can also be used for a variety of purposes. However,...
|
by: Charles Arthur |
last post by:
How do i turn on java script on a villaon, callus and itel keypad mobile phone
|
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...
|
by: ryjfgjl |
last post by:
In our work, we often receive Excel tables with data in the same format. If we want to analyze these data, it can be difficult to analyze them because the data is spread across multiple Excel files...
|
by: emmanuelkatto |
last post by:
Hi All, I am Emmanuel katto from Uganda. I want to ask what challenges you've faced while migrating a website to cloud.
Please let me know.
Thanks!
Emmanuel
|
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...
|
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...
|
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,...
|
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...
| |