1. This site uses cookies. By continuing to use this site, you are agreeing to our use of cookies. Learn More.
  2. Anuncie Aqui
    Anuncie aqui você Também: fdantas@4each.com.br

[Python] Python multiprocessing function multiple parameters

Discussão em 'Python' iniciado por Stack, Fevereiro 11, 2025.

  1. Stack

    Stack Membro Participativo

    trying to run a function with 'X' cores simultaneously that has multiple parameters. with PROCESS I cant set the number of cores, and with POOL I cant set multiple parameters for a function.

    def funct(a, b):
    #run .bat file with params (a,b)

    if __name__ == '__main__':
    cores = int(cores) #set with input
    pool = Pool(processes=cores)
    pool.map(funct(3, 44))


    Im getting this error:

    TypeError: Pool.map() missing 1 required positional argument: 'iterable'


    I cant use this, because I cant set Cores

    p = Process(target=funct, args=(1,2))

    Continue reading...

Compartilhe esta Página