Skip to main content

Tengo un problema con el multiprocesado de mi programa. Este es el errorcodigo del programa y debajo del mismo inserto el codigo del programaerror:

Programa:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 119, in worker
    result = (True, func(*args, **kwds))
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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)

Error:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 119, in worker
    result = (True, func(*args, **kwds))
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 608, in get
    raise self._value
TypeError: 'NoneType' object is not callable

Tengo un problema con el multiprocesado de mi programa. Este es el error y debajo del mismo inserto el codigo del programa:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 119, in worker
    result = (True, func(*args, **kwds))
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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)

Tengo un problema con el multiprocesado de mi programa. Este es el codigo del programa y debajo inserto el error:

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)

Error:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 119, in worker
    result = (True, func(*args, **kwds))
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 608, in get
    raise self._value
TypeError: 'NoneType' object is not callable
Origen Enlace

Python multiprocessing(Pool) error

Tengo un problema con el multiprocesado de mi programa. Este es el error y debajo del mismo inserto el codigo del programa:

multiprocessing.pool.RemoteTraceback:
"""
Traceback (most recent call last):
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 119, in worker
    result = (True, func(*args, **kwds))
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    py", line 260, in map
    return self._map_async(func, iterable, mapstar, chunksize).get()
  File     "C:\Users\santi\AppData\Local\Programs\Python\Python35\lib\multiprocessing\pool.    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)