Author Bharatsolanki
Recipients Bharatsolanki
Date 2020-03-18.19:50:43
SpamBayes Score -1.0
Marked as misclassified Yes
Message-id <1584561043.46.0.995570290808.issue40005@roundup.psfhosted.org>
In-reply-to
Content
Hi Team,

Below code is giving different result in python 2.7 and 3.7 version. Code is running fine when i am using 2.7 but in 3.7, it is showing error.  

from multiprocessing import Pool
import traceback
class Utils: def __init__(self): self.count = 10

def function(): global u1 u1 = Utils() l1 = range(3) process_pool = Pool(1) try: process_pool.map(add, l1, 1) process_pool.close() process_pool.join() except Exception as e: process_pool.terminate() process_pool.join() print(traceback.format_exc()) print(e)
def add(num): total = num + u1.count print(total)
if __name__ == "__main__": function()

Could you please help me on this how can it run in 3.7 version.

Thanks,
Bharat
History
Date User Action Args
2020-03-18 19:50:43Bharatsolankisetrecipients: + Bharatsolanki
2020-03-18 19:50:43Bharatsolankisetmessageid: <1584561043.46.0.995570290808.issue40005@roundup.psfhosted.org>
2020-03-18 19:50:43Bharatsolankilinkissue40005 messages
2020-03-18 19:50:43Bharatsolankicreate