473,473 Members | 2,138 Online
Bytes | Software Development & Data Engineering Community
Create Post

Home Posts Topics Members FAQ

Another MSIE Python Question

I am opening MSIE6 with this code:

ie=Dispatch('InternetExplorer.Application.1')
ie.Navigate(url)
while ie.Busy:
time.sleep(0.1)
ied=ie.Document
while ied.ReadyState != 'complete':
time.sleep(0.1)

ieh=ied.documentElement.outerHTML
When opening Word or Excel, and using Dispatch('Word.Application') or
Dispatch('Excel.Application'), the app comes up and is available and can be
brought up on the screen by setting .Visible = 1. When using the above code,
IE will not come up. I have to open IE by clicking on its icon and then the
above code will work. If I don't do that I get a stack dump and my python
program crashes.

Any help would be appreciated.
Jul 18 '05 #1
6 2023
Ralph A. Gable wrote:
I am opening MSIE6 with this code:

ie=Dispatch('InternetExplorer.Application.1')
ie.Navigate(url)
while ie.Busy:
time.sleep(0.1)
ied=ie.Document
while ied.ReadyState != 'complete':
time.sleep(0.1)

ieh=ied.documentElement.outerHTML
When opening Word or Excel, and using Dispatch('Word.Application') or
Dispatch('Excel.Application'), the app comes up and is available and can be
brought up on the screen by setting .Visible = 1. When using the above code,
IE will not come up. I have to open IE by clicking on its icon and then the
above code will work. If I don't do that I get a stack dump and my python
program crashes.

Any help would be appreciated.


Based on the above description, is it possible that the fact
that you aren't doing "ie.Visible = 1" is responsible?

Also, please include the traceback when saying that your Python program
crashes... this usually eliminates whole classes of possible causes,
and often points directly to the trouble for someone who's been there
before.

-Peter
Jul 18 '05 #2
Ralph A. Gable wrote:
I am opening MSIE6 with this code:

ie=Dispatch('InternetExplorer.Application.1')
ie.Navigate(url)
while ie.Busy:
time.sleep(0.1)
ied=ie.Document
while ied.ReadyState != 'complete':
time.sleep(0.1)

ieh=ied.documentElement.outerHTML
When opening Word or Excel, and using Dispatch('Word.Application') or
Dispatch('Excel.Application'), the app comes up and is available and can be brought up on the screen by setting .Visible = 1. When using the above code, IE will not come up. I have to open IE by clicking on its icon and then the above code will work. If I don't do that I get a stack dump and my python
program crashes.


My working code is similar to yours, but I use
'InternetExplorer.Application' instead of 'InternetExplorer.Application.1'
in the Dispatch call. I wonder if that could make the difference.

-Mike
Jul 18 '05 #3
Here's the stack dump:
Traceback (most recent call last):
File "<interactive input>", line 1, in ?
File "C:\Python22\lib\ufutil.py", line 661, in updatetocurrent
getplayerdata(l,i)
File "C:\Python22\lib\ufutil.py", line 478, in getplayerdata
ie=Dispatch('InternetExplorer.Application.1')
File "C:\Python22\lib\site-packages\win32com\client\__init__.py",
line 95, in Dispatch
dispatch, userName =
dynamic._GetGoodDispatchAndUserName(dispatch,userN ame,clsctx)
File "C:\Python22\lib\site-packages\win32com\client\dynamic.py",
line 84, in _GetGoodDispatchAndUserName
return (_GetGoodDispatch(IDispatch, clsctx), userName)
File "C:\Python22\lib\site-packages\win32com\client\dynamic.py",
line 72, in _GetGoodDispatch
IDispatch = pythoncom.CoCreateInstance(IDispatch, None, clsctx,
pythoncom.IID_IDispatch)
com_error: (-2147221231, 'ClassFactory cannot supply requested class',
None, None)
Peter Hansen <pe***@engcorp.com> wrote in message news:<P8********************@powergate.ca>...
Ralph A. Gable wrote:
I am opening MSIE6 with this code:

ie=Dispatch('InternetExplorer.Application.1')
ie.Navigate(url)
while ie.Busy:
time.sleep(0.1)
ied=ie.Document
while ied.ReadyState != 'complete':
time.sleep(0.1)

ieh=ied.documentElement.outerHTML
When opening Word or Excel, and using Dispatch('Word.Application') or
Dispatch('Excel.Application'), the app comes up and is available and can be
brought up on the screen by setting .Visible = 1. When using the above code,
IE will not come up. I have to open IE by clicking on its icon and then the
above code will work. If I don't do that I get a stack dump and my python
program crashes.

Any help would be appreciated.


Based on the above description, is it possible that the fact
that you aren't doing "ie.Visible = 1" is responsible?

Also, please include the traceback when saying that your Python program
crashes... this usually eliminates whole classes of possible causes,
and often points directly to the trouble for someone who's been there
before.

-Peter

Jul 18 '05 #4
Ralph A. Gable wrote:

[traceback snipped]

So what if you drop the '.1' from the end of the AppId, and
also make sure you have the "ie.Visible = 1" in there?

Can you upgrade to the latest versions of Python and pywin32
as well? I notice you are using 2.2 still...

(No idea if any of these things will help... I'm spending a
lot of time struggling with COM right now as well, though
with troubles in entirely different areas.)

-Peter
Jul 18 '05 #5
I have dropped the .1. I don't even get to the point where I CAN set
..Visible=1 since it crashes before it brings up msie.

I guess I wasn't clear enough in the original message. What I want to
do is be able to bring up an instance of msie (and NOT make if
visible) that python can use and that will not be seen by the user,
i.e. I want all the operations I am performing with msie to be hidden
from the user so said user can go about his/her business and never
know anything is going on. In the case of Word/Excel I can do that
with no problem. I just don't set .Visible to 1 but when trying to use
msie (with python) I can't do it unless I already have an instance of
msie running BEFORE I run the code cited below.
Peter Hansen <pe***@engcorp.com> wrote in message news:<PM********************@powergate.ca>...
Ralph A. Gable wrote:

[traceback snipped]

So what if you drop the '.1' from the end of the AppId, and
also make sure you have the "ie.Visible = 1" in there?

Can you upgrade to the latest versions of Python and pywin32
as well? I notice you are using 2.2 still...

(No idea if any of these things will help... I'm spending a
lot of time struggling with COM right now as well, though
with troubles in entirely different areas.)

-Peter

Jul 18 '05 #6
r.*****@mchsi.com (Ralph A. Gable) wrote in message news:<22************************@posting.google.co m>...
I am opening MSIE6 with this code:

ie=Dispatch('InternetExplorer.Application.1')
ie.Navigate(url)
while ie.Busy:
time.sleep(0.1)
ied=ie.Document
while ied.ReadyState != 'complete':
time.sleep(0.1)

ieh=ied.documentElement.outerHTML

I have tried your code as is (added imports, of course) and it worked.
IE didn't show up in taskbar, url was loaded and outerHTML contained,
well, HTML :)

Test environment: Win2k, MSIE 6 and ActivePython 2.3.

- kv
Jul 18 '05 #7

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

Similar topics

13
by: Rudolf Horbas | last post by:
G'day, has any of You ever experienced the problem that posted forms deliver an empty $_POST-array? I have a form like: <form method="POST" action="https://.../result.html?qid=70"> <input...
0
by: Sugapablo | last post by:
I'm having trouble formatting a table properly in MSIE. What I have works in Mozilla and just won't work in MSIE. This is the code: http://www.sugapablo.net/temp/html.txt Here is an image...
4
by: MasonC | last post by:
I discovered our library system has Netscape 4.79 and that my web pages are readable but somewhat mucked up on it. In your experienced opinion should I ignore it or attempt to adjust my pages to...
0
by: javaguy | last post by:
I have a table I hide show/hide through a pair of divs. The show/hide part works fine in both Mozilla and MSIE. When switching between the hide and show versions the Mozilla browser keeps them in...
8
by: Mason A. Clark | last post by:
Did I miss something? Perhaps coincident with the advent of Microsoft's SP2, my font sizes seen in MSIE have shrunk to near unreadability. Firefox and Opera are ok but both have minimal font...
3
by: Gérard Talbot | last post by:
About a month ago, I've reported a crash bug at a wiki webpage where developers of MSIE 7 can read feedback from developers. The strange thing is that a particular malformed webpage can crash MSIE...
8
by: Paul Cochrane | last post by:
Hi all, I've got an application that I'm writing that autogenerates python code which I then execute with exec(). I know that this is not the best way to run things, and I'm not 100% sure as to...
17
by: Eric_Dexter | last post by:
def simplecsdtoorc(filename): file = open(filename,"r") alllines = file.read_until("</CsInstruments>") pattern1 = re.compile("</") orcfilename = filename + "orc" for line in alllines: if not...
3
by: LRI41 | last post by:
I googled an error message and it came up with two posts on your forum and when I got there it said I needed to register to post my question, I am not sure whether is this the correct place 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
marktang
by: marktang | last post by:
ONU (Optical Network Unit) is one of the key components for providing high-speed Internet services. Its primary function is to act as an endpoint device located at the user's premises. However,...
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
tracyyun
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each...
0
agi2029
by: agi2029 | last post by:
Let's talk about the concept of autonomous AI software engineers and no-code agents. These AIs are designed to manage the entire lifecycle of a software development project—planning, coding, testing,...
1
isladogs
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new...
0
by: conductexam | last post by:
I have .net C# application in which I am extracting data from word file and save it in database particularly. To store word all data as it is I am converting the whole word file firstly in HTML and...
0
by: TSSRALBI | last post by:
Hello I'm a network technician in training and I need your help. I am currently learning how to create and manage the different types of VPNs and I have a question about LAN-to-LAN VPNs. The...
0
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated ...

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.