Open file function when --onefile is used
When making a .EXE file with pyinstaller all files must be opened from the sys._MEIPASS "folder" and not the "./" one. To make it simpler it's better to have a openfile function like the following one:
filename = 'filename.ext'
try:
base_path = sys._MEIPASS
except AttributeError:
base_path = './'
filename = os.path.join(base_path, filename)