[Python] How can I make joblib works with executable files (.exe)

Discussão em 'Python' iniciado por Stack, Maio 23, 2025.

  1. Stack

    Stack Membro Participativo

    I developed a program in python to organize data that comes from xlsx and csv and convert it to csv. To accelerate the program, I am using joblib to do parallel processing. The program is working fine when I run on the console, but it doesn't work when I generate an executable using pyinstaller. When I run it, nothing appears on the terminal.

    The main code:

    import Conv
    from os import getcwd
    from time import time
    from Df_2_csv import createFolder
    from joblib import Parallel, delayed

    #Getting the initial time
    t0=time()

    path=(getcwd()).replace("\\","/")

    #Creating a folder "Csv" if it doesn't exist
    newPath=createFolder(path)

    #Getting all files of each type
    all_xlsx= Conv.getAllOfType(path,".xlsx")
    all_csv= Conv.getAllOfType(path,".csv")

    #Getting the lenght of the lists
    len_all=Conv.len_all(all_xlsx,all_csv)

    #Run along xlsx files
    Result=Parallel(n_jobs=-1)(delayed(Conv.conv_xlsx)(
    fileName,path,newPath,t0,index,len_all) for index,fileName in enumerate(all_xlsx))

    #Run along csv files
    Result=Parallel(n_jobs=-1)(delayed(Conv.conv_csv)(
    fileName,path,newPath,t0,index,len_all) for index,fileName in enumerate(all_csv,start=len(all_xlsx)))


    I generated the executable using:

    pyinstaller --onefile Main.py

    Continue reading...

Compartilhe esta Página