Thanks

On 7/3/07, Jim Vickroy <[EMAIL PROTECTED]> wrote:

 James Matthews wrote:

Thanks Emlyn

Just one more issue i have here. When i pass a string as an argument to
the thread it seems to call the method returning the string as a tuple and i
get an error that the method gets 48 arguments and it can only accept 2?

If this doesn't make sense here is the code.

for links in urls:
            links_thread = 
threading.Thread(target=self.next_page_finder,args=links)
# Links is a string

that argument (i.e., links) is expected to be a python tuple so what you
need is:
    links_thread = threading.Thread(target=self.next_page_finder
,args=(links,))

            threaded_objects.append(links_thread)
I get this error:
Exception in thread Thread-1:
Traceback (most recent call last):
  File "C:\Python25\lib\threading.py", line 460, in __bootstrap
    self.run()
  File "C:\Python25\lib\threading.py", line 440, in run
    self.__target(*self.__args, **self.__kwargs)
TypeError: next_page_finder() takes exactly 2 arguments (48 given)

Thanks

James


On 7/3/07, Emlyn Jones <[EMAIL PROTECTED]> wrote:
>
> On 7/3/07, Emlyn Jones <[EMAIL PROTECTED]> wrote:
> > On 7/3/07, Tim Roberts <[EMAIL PROTECTED]> wrote:
> > James Matthews wrote:
> > > > So i need to make the list a global variable
> > >
> > > No, that's not what he did at all.  The names just happened to be
> the
> > > same, that's all.  Consider it this way:
> > >
> > >     import threading
> > >     def foo( threadresult ):
> > >         threadresult.extend( range(4) )
> > >
> > >     result = list()
> > >     thread = threading.Thread (target=foo, args=(result,))
> > >     thread.start()
> > >     result
> > >
>
> How about using an object derived from Thread and making 'result' a
> member of it?
>
> http://docs.python.org/lib/thread-objects.html
>
> You'd probably also want a variable to tell you if the function has
> finished.
>
> --
> ()  ascii ribbon campaign - against html e-mail
> /\   www.asciiribbon.org   - against proprietary attachments
> _______________________________________________
> Python-win32 mailing list
> Python-win32@python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



--
http://www.goldwatches.com/watches.asp?Brand=14
http://www.jewelerslounge.com

------------------------------

_______________________________________________
Python-win32 mailing list
[EMAIL PROTECTED]://mail.python.org/mailman/listinfo/python-win32





--
http://www.goldwatches.com/watches.asp?Brand=14
http://www.jewelerslounge.com
_______________________________________________
Python-win32 mailing list
Python-win32@python.org
http://mail.python.org/mailman/listinfo/python-win32

Reply via email to