Diez B. Roggisch wrote:
> Teja wrote:
>> >
> > Dennis Lee Bieber wrote:
> >> On 17 Oct 2006 00:58:59 -0700, "Teja" <tejovathi.p at gmail.com> declaimed
> >> the following in comp.lang.python:
> >>
> >> > thread.start_new_thread(self.nav, (s,'www.google.com')
> >> >
> >> > I am getting an attribute error
> >>
> >> That can not be the REAL code... I'd expect a syntax error... You
> >> have mismatched parens on that line!
> >> --
> >> Wulfraed Dennis Lee Bieber KD6MOG
> >> wlfraed at ix.netcom.comwulfraed at bestiaria.com> >> HTTP://wlfraed.home.netcom.com/> >> (Bestiaria Support Staff: web-asst at bestiaria.com)
> >> HTTP://www.bestiaria.com/> >
> > Hi,
> >
> > Ya its a copy paste error... But can u please let me know what is the
> > reason for attribute error and how to rectify it??
>> How many times need you a beating with a clue-stick?
>> Post the _actual_ code, not something that closely resembles it - in _your_
> opinion....
>> Post the error message!!!!
>> And before you do all this, read:
>>http://www.catb.org/~esr/faqs/smart-questions.html>> Diez
OK Ok .. Here is the final code thats giving an error:
GenericFunctions.py
----------------------------------
import win32com.client, pythoncom, thread
ie=win32com.client.Dispatch('internetexplorer.application')
ie.Visible=1
class GenericFunctions:
def __init__(self):
print "In Constructor of Generic Functions"
def MyNavigate(self,dest):
ie.Navigate(dest)
---------------------------------------------------------------------------------------------------------------
MainThread.py
--------------------------
import win32com.client, pythoncom, thread
from GenericFunctions import *
obj = GenericFunctions()
import sys,traceback
def threadFunction(s,dest):
pythoncom.CoInitialize()
try:
d=pythoncom.CoGetInterfaceAndReleaseStream(s,
pythoncom.IID_IDispatch)
my_ie=win32com.client.Dispatch(d)
#d.MyNavigate(dest)
obj.MyNavigate(dest) # this is gving an error.
except:
my_ie = None
print traceback.print_exc(file= sys.stdout)
pythoncom.CoUninitialize()
if __name__ == "__main__":
s=pythoncom.CoMarshalInterThreadInterfaceInStream(pythoncom.IID_IDispatch,ie)
thread.start_new_thread(threadFunction, (s,'www.google.com'))
-----------------------------------------------------------------------------------------------------------------------------
And here is the error:
Traceback (most recent call last):
File "C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\MainThread.py", line 13, in threadFunction
obj.MyNavigate(dest) # this is gving an error.
File "C:\Documents and Settings\dzxbrn\Desktop\Stop Test\13
Oct\GenericFunctions.py", line 9, in MyNavigate
ie.Navigate(dest)
File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line
489, in __getattr__
raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: internetexplorer.application.Navigate
None
This is highly urgent and important... Please help me out....
Thnks & Regards,
Tejovathi.P