WIn32api

K-Dawg kdawg44 at gmail.com
Fri Feb 6 11:28:07 EST 2009


I have come up with what I need and will try tweaking some things that
hopefully will help me learn what some of this stuff does.  In the meantime,
I am having an issue:


class *KeepAlive*(threading.Thread):

    def *__init__*(*self*):

        *self*.count = 0

        *self*.ie=win32com.client.Dispatch(*'internetexplorer.application'*)

        *self*.ie.Visible=0

        threading.Thread.__init__(*self*)

    def *run*(*self*):

        *self*.ie.Navigate(URL)

        sleep(5)

        while True:

            sleep(1)

            *self*.count += 1

            *self*.timeLeft = str((300 - *self*.count)/60) + *":"* + str((
300 - *self*.count)%60) + *" until next refresh"
*

            print *self*.timeLeft

            if *self*.count == 300:

                *self*.ie.Refresh()

                *self*.count = 0



This works if I call run() specifically.  But when I try to initiate the
thread with .start() I get the following error

Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python25\lib\threading.py", line 486, in __bootstrap_inner
    self.run()
  File "C:\app.py", line 104, in run
    self.ie.Navigate(URL)
  File "C:\Python25\lib\site-packages\win32com\client\dynamic.py", line 500,
in
__getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: internetexplorer.application.Navigate

What does this mean?  Why is it only happening when I am trying to do this
in a thread?

Thanks for any help.



Kevin
-------------- next part --------------
An HTML attachment was scrubbed...
URL: <http://mail.python.org/pipermail/python-list/attachments/20090206/f31968c5/attachment-0001.html>


More information about the Python-list mailing list