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.