monkey/infection_monitor/data/__init__.py

16 lines
388 B
Python
Raw Normal View History

2015-08-30 15:27:35 +08:00
import os
import sys
__author__ = 'itamar'
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("data")
return os.path.join(base_path, relative_path)