Hi all, I am trying to run two functions at the same time with Parallel Processing (pp) as following ;
import pygame import sys import time import math import pp screen = pygame.display.set_mode((0, 0), pygame.FULLSCREEN) timer = pygame.time.Clock() white = True start = time.time() end = time.time() - start def test1(): global end 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 end while(end2<5): end2 = time.time() - start print end ppservers = () if len(sys.argv) > 1: ncpus = int(sys.argv[1]) # Creates jobserver with ncpus workers job_server = pp.Server(ncpus, ppservers=ppservers) else: # Creates jobserver with automatically detected number of workers job_server = pp.Server(ppservers=ppservers) print "Starting PP with", job_server.get_ncpus(), "workers" job1 = job_server.submit(test1,test2) result = job1() And the output is ; Starting PP with 2 workers Traceback (most recent call last): File "fl.py", line 46, in <module> job1 = job_server.submit(test1,test2) File "/usr/lib/python2.6/site-packages/pp.py", line 402, in submit raise TypeError("args argument must be a tuple") TypeError: args argument must be a tuple When I change job1 to just to see if it will run one function only; job1 = job_server.submit(test1) I get an output of; NameError: global name 'end' is not defined end variable is defined as global but I get a NameError. Anyone has an idea what's going on ? -- http://mail.python.org/mailman/listinfo/python-list