By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
440,676 Members | 2,236 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 440,676 IT Pros & Developers. It's quick & easy.

Access denied calling FireEvent in Python

P: n/a
Hello,

Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.

Here is what I am trying to do:
Set the "campus" listbox value and theb call fire event, such as in the
code below. I get an "access denied" error.

example code:
ie = DispatchEx('InternetExplorer.Application')

# Some code to navigate to the site, wait till doc is not busy and #
ReadyState is complete...blah..blah...

ie.Document.forms[0].campus.value = '200'
ie.Document.forms[0].campus.fireEvent('onchange')

HTML code:
<select style="font-size: 10" name="campus" onChange="if
(this.options[this.selectedIndex].value != 0)
populate(this.options[this.selectedIndex].value)">
<option value=0>Select a campus
<option value="200">Norman Campus
<option value="501">Advanced Programs
<option value="502">Liberal Studies
<option value="504">Academic Programs (CAFE)
<option value="505">OU Tulsa</select>
If you call:
fireEvent('onchange')
fireEvent('onclick')
fireEvent('onFocus') etc... You will get an Access Denied

This only happens with either the newer version of IE and XP2.
I was able to call the exact same code with XP1 and Win2000 Pro
and it work fine. So something has changed with I.E. and is not being
handled in Python.
example code:
ie.Document.forms[0].campus.fireEvent('onchange')

Trace:
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" ,
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\QA\Tools\cPAMIE150\oCScript2.py", line 24, in ?
ie2.Document.forms[0].campus.fireEvent('onchange')
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line
165, in __call__
return
self._get_good_object_(self._oleobj_.Invoke(*allAr gs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147024891, 'Access is denied.', None, None)

Help would be much appreciated!!

RLM

Jul 18 '05 #1
Share this Question
Share on Google+
2 Replies


P: n/a
Found that you have to call FireEvent a different way in the News IE
and sp2
Instead of:

ie.Document.forms[0].campus.fi*reEvent('onchange')

if needs to be changed to:
ie.Document.forms[0].campus.Fi*reEvent('onchange')
RLM

ca*****@yahoo.com wrote:
Hello,

Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.

Here is what I am trying to do:
Set the "campus" listbox value and theb call fire event, such as in the code below. I get an "access denied" error.

example code:
ie = DispatchEx('InternetExplorer.Application')

# Some code to navigate to the site, wait till doc is not busy and #
ReadyState is complete...blah..blah...

ie.Document.forms[0].campus.value = '200'
ie.Document.forms[0].campus.fireEvent('onchange')

HTML code:
<select style="font-size: 10" name="campus" onChange="if
(this.options[this.selectedIndex].value != 0)
populate(this.options[this.selectedIndex].value)">
<option value=0>Select a campus
<option value="200">Norman Campus
<option value="501">Advanced Programs
<option value="502">Liberal Studies
<option value="504">Academic Programs (CAFE)
<option value="505">OU Tulsa</select>
If you call:
fireEvent('onchange')
fireEvent('onclick')
fireEvent('onFocus') etc... You will get an Access Denied

This only happens with either the newer version of IE and XP2.
I was able to call the exact same code with XP1 and Win2000 Pro
and it work fine. So something has changed with I.E. and is not being
handled in Python.
example code:
ie.Document.forms[0].campus.fireEvent('onchange')

Trace:
File
"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" , line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\QA\Tools\cPAMIE150\oCScript2.py", line 24, in ?
ie2.Document.forms[0].campus.fireEvent('onchange')
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py", line 165, in __call__
return
self._get_good_object_(self._oleobj_.Invoke(*allAr gs),self._olerepr_.defaultDispatchName,None) com_error: (-2147024891, 'Access is denied.', None, None)

Help would be much appreciated!!

RLM


Jul 18 '05 #2

P: n/a
Regarding the call to FireEvent:

I still do not understand why you could call fi*reEvent('onchange')
and now it you have to call "Fi*reEvent('onchange')" to avoid the
Access denied message

In Ruby or Perl you still call "fi*reEvent('onchange')" it has not
changed and you do not get the access denied error.

If anyone has any helpful information regarding this it would be great.

Rob
ca*****@yahoo.com wrote:
Found that you have to call FireEvent a different way in the News IE
and sp2
Instead of:

ie.Document.forms[0].campus.fi*reEvent('onchange')

if needs to be changed to:
ie.Document.forms[0].campus.Fi*reEvent('onchange')
RLM

ca*****@yahoo.com wrote:
Hello,

Does anyone know a workaround for calling fireEvent.
With the latest from Microsoft OS XP2 and Hot fixes to
IE it now gives an "access denied" error in Python when called.

Here is what I am trying to do:
Set the "campus" listbox value and theb call fire event, such as in

the
code below. I get an "access denied" error.

example code:
ie = DispatchEx('InternetExplorer.Application')

# Some code to navigate to the site, wait till doc is not busy and # ReadyState is complete...blah..blah...

ie.Document.forms[0].campus.value = '200'
ie.Document.forms[0].campus.fireEvent('onchange')

HTML code:
<select style="font-size: 10" name="campus" onChange="if
(this.options[this.selectedIndex].value != 0)
populate(this.options[this.selectedIndex].value)">
<option value=0>Select a campus
<option value="200">Norman Campus
<option value="501">Advanced Programs
<option value="502">Liberal Studies
<option value="504">Academic Programs (CAFE)
<option value="505">OU Tulsa</select>
If you call:
fireEvent('onchange')
fireEvent('onclick')
fireEvent('onFocus') etc... You will get an Access Denied

This only happens with either the newer version of IE and XP2.
I was able to call the exact same code with XP1 and Win2000 Pro
and it work fine. So something has changed with I.E. and is not being handled in Python.
example code:
ie.Document.forms[0].campus.fireEvent('onchange')

Trace:
File

"C:\Python23\Lib\site-packages\pythonwin\pywin\framework\scriptutils.py" ,
line 310, in RunScript
exec codeObject in __main__.__dict__
File "C:\QA\Tools\cPAMIE150\oCScript2.py", line 24, in ?
ie2.Document.forms[0].campus.fireEvent('onchange')
File "C:\Python23\Lib\site-packages\win32com\client\dynamic.py",

line
165, in __call__
return

self._get_good_object_(self._oleobj_.Invoke(*allAr gs),self._olerepr_.defaultDispatchName,None)
com_error: (-2147024891, 'Access is denied.', None, None)

Help would be much appreciated!!

RLM


Jul 18 '05 #3

This discussion thread is closed

Replies have been disabled for this discussion.