Advertisement
Guest User

Untitled

a guest
Jan 24th, 2017
328
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.75 KB | None | 0 0
  1. multiprocessing.pool.RemoteTraceback:
  2. """
  3. Traceback (most recent call last):
  4. File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 119, in worker
  5. result = (True, func(*args, **kwds))
  6. File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 44, in mapstar
  7. return list(map(*args))
  8. TypeError: 'NoneType' object is not callable
  9. """
  10.  
  11. The above exception was the direct cause of the following exception:
  12.  
  13. Traceback (most recent call last):
  14. File "Prime number checker.py", line 33, in <module>
  15. p.map(primenumber(), num)
  16. File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 260, in map
  17. return self._map_async(func, iterable, mapstar, chunksize).get()
  18. File "C:UserssantiAppDataLocalProgramsPythonPython35libmultiprocessingpool. py", line 608, in get
  19. raise self._value
  20. TypeError: 'NoneType' object is not callable
  21.  
  22.  
  23.  
  24. Programa:
  25.  
  26.  
  27. import argparse
  28. import sys
  29. import multiprocessing
  30. from multiprocessing import Pool
  31. import time
  32.  
  33. def main():
  34. parser = argparse.ArgumentParser()
  35. parser.add_argument("--x", type=float, default=1.0)
  36. args = parser.parse_args()
  37. sys.stdout.write(str(numeroprimo()))
  38.  
  39. num = input("Inserte un numero: ")
  40.  
  41.  
  42. def numeroprimo():
  43. if int(num) > 1:
  44. for i in range(2, int(num)):
  45. if (int(num) % i) == 0:
  46. print(num, "no es un numero primo")
  47. break
  48. else:
  49. print(num, "es un numero primo")
  50. else:
  51. print(num, "no es un numero primo")
  52.  
  53.  
  54. if __name__ == "__main__":
  55. main()
  56. t1 = time.time()
  57. for x in range(1):
  58. p = Pool()
  59. p.map(numeroprimo(), num)
  60. p.close()
  61. p.join()
  62. print("Tomó:", time.time()-t1)
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement