win32all: buggy IE proxy stuff and execScript()

G

gcash

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

<http://groups.google.com/[email protected]>

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
context.

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 www.python.org
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
machine.

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"
item.
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
problems.

Am I really the first person to run into this?

-gc
 

Ask a Question

Want to reply to this thread or ask your own question?

You'll need to choose a username for the site, which only take a couple of moments. After that, you can post your question and our members will help you out.

Ask a Question

Members online

Forum statistics

Threads
473,768
Messages
2,569,574
Members
45,050
Latest member
AngelS122

Latest Threads

Top