Skip to content

Commit acf0973

Browse files
committed
Correctly load data when frozen
1 parent 35e20a2 commit acf0973

1 file changed

Lines changed: 3 additions & 2 deletions

File tree

IsotopeDistributionCalculator.py

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -98,13 +98,14 @@ def normpdf(*args):
9898
def resource_path(relative_path):
9999
""" Get absolute path to resource, works for dev and for PyInstaller """
100100
if getattr(sys, 'frozen', False): # frozen
101-
base_path = os.path.dirname(os.path.realpath(sys.executable))
101+
base_path = sys._MEIPASS
102102
else: # unfrozen
103-
base_path = os.path.dirname(os.path.realpath(__file__))
103+
base_path = os.path.dirname(os.path.abspath(__file__))
104104

105105
return os.path.join(base_path, relative_path)
106106

107107
APP_NAME = 'Isotope Distribution Calculator'
108+
108109
APP_ICON = resource_path('Atom.ico')
109110
DRAW_ICON = resource_path('Bina-pencil-green.png')
110111
ANNOTATE_THRESHOLD = 2.0

0 commit comments

Comments
 (0)