On Jan 8, 6:00 pm, Chris Angelico <ros...@gmail.com> wrote: > On Mon, Jan 9, 2012 at 2:45 AM, Yigit Turgut <y.tur...@gmail.com> wrote: > > job1 = job_server.submit(test1,()) > > job2 = job_server.submit(test2()) > > The first of these passes test1 and an empty tuple as arguments to > submit(). The second calls test2 with no arguments, then passes its > return value to submit(), which is not what you want to do. > > Chris Angelico
Yes that's correct but (test1,()) doesn't do any good since it doesn't execute the loop. screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) timer = pygame.time.Clock() white = True start = time.time() end = time.time() - start end2= time.time() - start def test1(): global end global white while(end<5): end = time.time() - start timer.tick(4) #FPS screen.fill((255,255,255) if white else (0, 0, 0)) white = not white pygame.display.update() def test2(): global end2 while(end2<5): end2 = time.time() - start print end2 ppservers = () job_server = pp.Server(ppservers=ppservers) job1 = job_server.submit(test1, (), globals=globals()) job2 = job_server.submit(test2, (), globals=globals()) result = job1() result2 = job2() print result2 job_server.print_stats() This *supposed to* print values of 'end' and simultaneously execute test1. Eventhough I set globals parameter and nothing seems to be wrong this code generates the following traceback ; Starting pp with 2 workers An error has occured during the function execution Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/ppworker.py", line 90, in run __result = __f(*__args) File "<string>", line 4, in test1 NameError: global name 'end' is not defined An error has occured during the function execution Traceback (most recent call last): File "/usr/lib/python2.6/site-packages/ppworker.py", line 90, in run __result = __f(*__args) File "<string>", line 3, in test2 NameError: global name 'end2' is not defined How can this be, what am I missing ? -- http://mail.python.org/mailman/listinfo/python-list