0

I am working on a python script which takes some files(.py) as its input and fetches data from the file. I am including the files as"./plugins" , where the Analysers folder have the .py files. It is working fine when I am running the main file from Pycharm .

This is the code which i am using to fetch the list of files and use it:

def plugins_list(type):
    """ List all python modules in specified plugins folders """
    plugpath = path.join('.','plugins')
    


    plugins_dirs = path.join(plugpath,type)

    for pathFile in plugins_dirs.split(pathsep):
        for filename in listdir(pathFile):

            name, ext = path.splitext(filename)

            # print("++"+name)
            if ext.endswith(".py"):
                # TODO adapt prefix ....
                yield "plugins."+type+"."+name

I am aware of the fact that Pyinstaller copies the files into some temporary directory starting with _MEIXXXXX. I tried including the files in the .spec file also but it was not giving me the accurate results. I just want to know how to make the pyinstaller import the files from the relative path.

  • 1
    Does this answer your question? https://stackoverflow.com/questions/7674790/bundling-data-files-with-pyinstaller-onefile – oskros Jan 05 '21 at 12:42
  • Hi @oskros, I tried the same..Now i am getting the folder and its contents inside the temp folder where it should be present. But I am really surprised that now my exe is unable to import all the folder content even from inside the temp folders. I have 8 file inside the folder which my exe should import and perform actions, but it is importing only first two and last two files – Supratik Biswas Jan 06 '21 at 04:35

0 Answers0