When creating a --onefile executable for windows with pyinstaller using speedmeter. The needles on the meters bug out due to not being able to find the needle.png. This line in particular to get an idea of what I mean.
Also, I am no expert so please forgive me if I am not very clear.
Problem:
module >> init.py
_image_dir = os.path.join(os.path.dirname(file), 'images')
My Current work around Solution:
Add the following and comment out the following in init.py
def resource_path(relative_path):
""" Get absolute path to resource, works for dev and for PyInstaller """
base_path = getattr(sys, '_MEIPASS', os.path.dirname(os.path.abspath(__file__)))
return os.path.join(base_path, relative_path)
_image_dir = os.path.join(resource_path(''), 'images')
#_image_dir = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'images')
Add the following to the pyinstaller .spec file. Of course change the location below to your directory
a.datas += [('images\needle.png','\location\to\kivy_garden\speedmeter\images\needle.png','DATA')]
When creating a --onefile executable for windows with pyinstaller using speedmeter. The needles on the meters bug out due to not being able to find the needle.png. This line in particular to get an idea of what I mean.
Also, I am no expert so please forgive me if I am not very clear.
Problem:
module >> init.py
_image_dir = os.path.join(os.path.dirname(file), 'images')
My Current work around Solution:
Add the following and comment out the following in init.py
Add the following to the pyinstaller .spec file. Of course change the location below to your directory
a.datas += [('images\needle.png','\location\to\kivy_garden\speedmeter\images\needle.png','DATA')]