win32all: buggy IE proxy stuff and execScript()

gcash gcash at
Thu Aug 7 03:21:36 CEST 2003

OK, I was writing code using WIN32ALL to do automation scripts for
common things we do in IE a lot at work, since grunt-n-point gets
very boring after a while. I snarfed the code from


which was very useful. (Thanks, Dave!)

Finally I get to a beta stage and give it to some of the guys in my
group to test, and they get "Access is denied" errors executing the
execScript() method, which runs some javascript in the browser

They're running pretty much the exact same windows install I am, so I
beat my head against the wall for a day trying to figure out what's
going on. Some people can run things as "Administrator", some folks
can run it as their user, some get it to work under both accounts, and
some can't get it to work under any account. My machine never had any
problems, even when I tried to make it break.

I'm using Win2K Pro SP 4 with all the critical patches, Python 2.2.3,
and win32all build 156.

I thought it was strange that I got NO Google hits on my error
message, and no one else was having the problem.

I was getting nowhere so I decided to post to comp.lang.python about
my problem and see if some bright person had an idea. Not only is this
the most coding I've ever done under Windows, but this is probably the
most I've USED Windows in years.

So I whipped up a short script to demonstrate the problem, and since
no one would have access to our internal sites, I used
as my example site.

I wanted to cut'n'paste the error message, so I ran the script on my
bosses' machine. AND IT WORKED. I changed the site back to our
internal website and it crashed. Obviously this immediately narrows it
down to the proxy settings, which I compared to the ones on my

It turns out that if the site is listed in the "bypass proxy" list, it
becomes a "Local Intranet" site and you get permission errors NO
MATTER how you set the permissions for the "Local Intranet" zone. I
experimented a lot with this, and I got my machine to finally get
permission errors.

Obviously a bug, but I didn't find anything in MSDN or MS KB on it.

Here's what you need to do as a workaround:

   1. Open the "Tools->Internet Options" menu.
   2. Select the "Security" tab.
   3. Click the "Local Intranet" zone icon.
   4. Click the "Sites" button.
   5. Uncheck the "Include all sites that bypass the proxy server"
   6. Hit the "OK" buttons twice.

That fixes it by putting these sites into the "Internet" zone, and you
have to do this for the Windows user(s) that will be running IE
scripts, as it's a per-user thing.

It seems that it doesn't matter what the permissions are for the
"Internet" zone, as I cranked those all the way up and didn't have any

Am I really the first person to run into this?


The Stones of Ranthenge are written through-and-through, though in an
ancient script composed solely of decimal points.  There are none who
understand these strange inscriptions outside of one order of Monks,
who refer to this place as "The Stones That Are Nine-Edge-Down".

More information about the Python-list mailing list