path.py (802B)
1 import os, inspect, sys 2 3 # def find_path(filename): 4 # """Return the correct filepath if you are running 5 # figENC as a bundled application 6 7 # Keyword arguments: 8 # filename -- the filename to convert to a filepath 9 # """ 10 # try: 11 # base_path = sys._MEIPASS 12 # except Exception: 13 # base_path = os.path.abspath(".") 14 # return os.path.join(base_path, filename) 15 16 def find_path(file): 17 """Return the correct filepath if you are running 18 figENC as a script 19 20 Keyword arguments: 21 file -- the filename to convert to a filepath 22 """ 23 return os.path.dirname( 24 os.path.abspath( 25 inspect.getfile( 26 inspect.currentframe() 27 ) 28 ) 29 ) + "/{}".format(file)