Advertisement
Not a member of Pastebin yet?
Sign Up,
it unlocks many cool features!
- multiprocessing.pool.RemoteTraceback:
- """
- Traceback (most recent call last):
- File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 119, in worker
- result = (True, func(*args, **kwds))
- File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 44, in mapstar
- return list(map(*args))
- TypeError: 'NoneType' object is not callable
- """
- The above exception was the direct cause of the following exception:
- Traceback (most recent call last):
- File "Prime number checker.py", line 33, in <module>
- p.map(primenumber(), num)
- File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 260, in map
- return self._map_async(func, iterable, mapstar, chunksize).get()
- File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 608, in get
- raise self._value
- TypeError: 'NoneType' object is not callable
- Programa:
- import argparse
- import sys
- import multiprocessing
- from multiprocessing import Pool
- import time
- def main():
- parser = argparse.ArgumentParser()
- parser.add_argument("--x", type=float, default=1.0)
- args = parser.parse_args()
- sys.stdout.write(str(numeroprimo()))
- num = input("Inserte un numero: ")
- def numeroprimo():
- if int(num) > 1:
- for i in range(2, int(num)):
- if (int(num) % i) == 0:
- print(num, "no es un numero primo")
- break
- else:
- print(num, "es un numero primo")
- else:
- print(num, "no es un numero primo")
- if __name__ == "__main__":
- main()
- t1 = time.time()
- for x in range(1):
- p = Pool()
- p.map(numeroprimo(), num)
- p.close()
- p.join()
- print("Tomó:", time.time()-t1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement