Skip to content

Commit 617f074

Browse files
committed
some pyinstaller support stuff
1 parent a5a8f05 commit 617f074

File tree

1 file changed

+16
-1
lines changed

1 file changed

+16
-1
lines changed

SRTM_clip_gui.py

Lines changed: 16 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,25 @@
11
import elevation
22
import PySimpleGUI as sg
3+
import sys
4+
import os
5+
6+
# os.chdir(sys._MEIPASS)
7+
8+
9+
if hasattr(sys, '_MEIPASS'):
10+
# PyInstaller >= 1.6
11+
os.chdir(sys._MEIPASS)
12+
os.environ["PATH"] += os.path.sep + sys._MEIPASS
13+
elif '_MEIPASS2' in os.environ:
14+
# PyInstaller < 1.6 (tested on 1.5 only)
15+
os.chdir(os.environ['_MEIPASS2'])
16+
os.environ["PATH"] += os.path.sep + os.environ['_MEIPASS2']
17+
else:
18+
pass
319

420
font=(sg.DEFAULT_FONT, 16)
521

622
elevation.clean() # Clear cache files, in case they are stale or corrupted
7-
823
def clip(out_file, bounds):
924
# Parse bounds into a tuple of floats
1025
clipped_data = elevation.clip(output=out_file, bounds=bounds)

0 commit comments

Comments
 (0)