Thanks<br><br><div><span class="gmail_quote">On 7/3/07, <b class="gmail_sendername">Jim Vickroy</b> <<a href="mailto:Jim.Vickroy@noaa.gov">Jim.Vickroy@noaa.gov</a>> wrote:</span><blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">
<div bgcolor="#ffffff" text="#000000"><span class="q">
James Matthews wrote:
<blockquote cite="http://mid8a6b8e350707031442h6a5561c5oeafe03a9ded2e2d9@mail.gmail.com" type="cite">Thanks Emlyn<br>
<br>
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?
<br>
<br>
If this doesn't make sense here is the code.<br>
<br>
for links in urls:<br>
links_thread =
threading.Thread(target=self.next_page_finder,args=links) # Links is a
string<br>
</blockquote></span>
that argument (i.e., links) is expected to be a python tuple so what
you need is:<br>
links_thread =
threading.Thread(target=self.next_page_finder,args=(links,))<br>
<br>
<blockquote cite="http://mid8a6b8e350707031442h6a5561c5oeafe03a9ded2e2d9@mail.gmail.com" type="cite"><div><span class="e" id="q_1138e0faf8fc7e52_3"> threaded_objects.append(links_thread)
<br>
I get this error:<br>
Exception in thread Thread-1:<br>
Traceback (most recent call last):<br>
File "C:\Python25\lib\threading.py", line 460, in __bootstrap<br>
self.run()<br>
File "C:\Python25\lib\threading.py", line 440, in run
<br>
self.__target(*self.__args, **self.__kwargs)<br>
TypeError: next_page_finder() takes exactly 2 arguments (48 given)<br>
<br>
Thanks<br>
<br>
James<br>
<br>
<br>
<div><span class="gmail_quote">On 7/3/07, <b class="gmail_sendername">
Emlyn Jones</b> <<a href="mailto:emlynj@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">emlynj@gmail.com</a>>
wrote:</span>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">On
7/3/07, Emlyn Jones <<a href="mailto:emlynj@gmail.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">emlynj@gmail.com</a>>
wrote:<br>
> On 7/3/07, Tim Roberts <<a href="mailto:timr@probo.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">timr@probo.com</a>>
wrote:<br>
> James Matthews wrote:<br>
> > > So i need to make the list a global variable<br>
> ><br>
> > No, that's not what he did at all. The names just happened
to be the<br>
> > same, that's all. Consider it this way:<br>
> ><br>
> > import threading<br>
> > def foo( threadresult ):<br>
> > threadresult.extend( range(4) )<br>
> ><br>
> > result = list()<br>
> > thread = threading.Thread
(target=foo, args=(result,))<br>
> > thread.start()<br>
> > result<br>
> ><br>
<br>
How about using an object derived from Thread and making 'result' a<br>
member of it?<br>
<br>
<a href="http://docs.python.org/lib/thread-objects.html" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://docs.python.org/lib/thread-objects.html</a><br>
<br>
You'd probably also want a variable to tell you if the function has
finished.<br>
<br>
--<br>
() ascii ribbon campaign - against html e-mail<br>
/\ <a href="http://www.asciiribbon.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">
www.asciiribbon.org</a> - against proprietary attachments<br>
_______________________________________________<br>
Python-win32 mailing list<br>
<a href="mailto:Python-win32@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Python-win32@python.org</a><br>
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.python.org/mailman/listinfo/python-win32</a><br>
</blockquote>
</div>
<br>
<br clear="all">
<br>
-- <br>
<a href="http://www.goldwatches.com/watches.asp?Brand=14" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.goldwatches.com/watches.asp?Brand=14</a><br>
<a href="http://www.jewelerslounge.com" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://www.jewelerslounge.com</a>
</span></div><pre><hr size="4" width="90%"><span class="q">
_______________________________________________<br>Python-win32 mailing list<br><a href="mailto:Python-win32@python.org" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">Python-win32@python.org</a>
<a href="http://mail.python.org/mailman/listinfo/python-win32" target="_blank" onclick="return top.js.OpenExtLink(window,event,this)">http://mail.python.org/mailman/listinfo/python-win32</a>
</span></pre>
</blockquote>
<br>
</div>
</blockquote></div><br><br clear="all"><br>-- <br><a href="http://www.goldwatches.com/watches.asp?Brand=14">http://www.goldwatches.com/watches.asp?Brand=14</a><br><a href="http://www.jewelerslounge.com">http://www.jewelerslounge.com
</a>