Re: questions about multiprocessing

2011-03-07 Thread Vincent Ren
I'm just learning python. After changed it to a non-OOP program, it works. Thank you all for suggestions :) On Mar 8, 1:38 pm, Benjamin Kaplan wrote: > Is there any particular reason you're using processes and not threads? > Functions that wait for stuff to happen in C land, such as I/O calls, >

Re: questions about multiprocessing

2011-03-07 Thread Benjamin Kaplan
On Mon, Mar 7, 2011 at 7:47 PM, Vincent Ren wrote: > Got it, thanks. > But what should I do if I want to improve the efficiency of my > program? > Is there any particular reason you're using processes and not threads? Functions that wait for stuff to happen in C land, such as I/O calls, release t

Re: questions about multiprocessing

2011-03-07 Thread Vincent Ren
Got it, thanks. But what should I do if I want to improve the efficiency of my program? On Mar 8, 11:37 am, Robert Kern wrote: > I'm afraid his response applies to this as well: you can't pass methods to > pool.map() or any other such communication channel to your subprocesses. -- http://mail

Re: questions about multiprocessing

2011-03-07 Thread Robert Kern
On 3/7/11 3:27 PM, Vincent Ren wrote: On Mar 7, 9:21 pm, Jean-Michel Pichavant wrote: It's a mistake many beginners do, I don't understand why, but it's a very common thing. RTFM should stand for "Read The Formidable (error) Message" as well. Your url is invalid, check your url definition. JM

Re: questions about multiprocessing

2011-03-07 Thread Vincent Ren
On Mar 7, 9:21 pm, Jean-Michel Pichavant wrote: > It's a mistake many beginners do, I don't understand why, but it's a > very common thing. RTFM should stand for "Read The Formidable (error) > Message" as  well. > Your url is invalid, check your url definition. > > JM I've fixed that problem. Bu

Re: questions about multiprocessing

2011-03-07 Thread Jean-Michel Pichavant
Vincent Ren wrote: Hello, everyone, recently I am trying to learn python's multiprocessing, but I got confused as a beginner. [SNIP] httplib.InvalidURL: nonnumeric port: '' Regards Vincent It's a mistake many beginners do, I don't understand why, but it's a very common thing. RTFM should

Re: questions about multiprocessing

2011-03-06 Thread Vincent Ren
I've got some new problems and I tried to search on Google but got no useful information. I want to download some images with multiprocessing.pool In my class named Renren, I defined two methods: def getPotrait(self, url): # get the current potraits of a friend on Renren.com

Re: questions about multiprocessing

2011-03-05 Thread Vincent Ren
Got it. After putting commas, it works (The 'o' was a mistake when I posted, sorry about it ). Thanks to all of you :) On Mar 5, 5:12 pm, Dennis Lee Bieber wrote: > On Fri, 4 Mar 2011 20:08:21 -0800 (PST), Vincent Ren > declaimed the following in > gmane.comp.python.general: > > > Hello, every

Re: questions about multiprocessing

2011-03-04 Thread Miki Tebeka
> otasks = [ > ... > print pool.map(f, tasks) You are running the maps on "tasks" while the list of URLs is called otasks (unless there's any error in the cut&paste). HTH, -- Miki -- http://mail.python.org/mailman/listinfo/python-list

Re: questions about multiprocessing

2011-03-04 Thread Philip Semanchuk
On Mar 4, 2011, at 11:08 PM, Vincent Ren wrote: > Hello, everyone, recently I am trying to learn python's > multiprocessing, but > I got confused as a beginner. > > If I run the code below: > > from multiprocessing import Pool > import urllib2 > otasks = [ > 'http://www.php.net' > 'http

questions about multiprocessing

2011-03-04 Thread Vincent Ren
Hello, everyone, recently I am trying to learn python's multiprocessing, but I got confused as a beginner. If I run the code below: from multiprocessing import Pool import urllib2 otasks = [ 'http://www.php.net' 'http://www.python.org' 'http://www.perl.org' 'http://www.gnu.org