So I was following this tutorial on how to convert my python project to an executable file: https://dev.to/eshleron/how-to-convert-py-to-exe-step-by-step-guide-3cfi
And I needed to write this function:
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
try:
# PyInstaller creates a temp folder and stores path in _MEIPASS
base_path = sys._MEIPASS
except Exception:
base_path = os.path.abspath(".")
return os.path.join(base_path, relative_path)
However VSCode is giving me this error: Module 'sys' has no '_MEIPASS' member. I have searched online for quite a long time and I still don't know how to fix it.