resource.py 405 B

1234567891011121314151617181920
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. from os import path
  4. import sys
  5. from sys import path as spath
  6. def resource_path(relative_path):
  7. try:
  8. base_path = sys._MEIPASS
  9. except Exception:
  10. base_path = path.abspath(".")
  11. return path.join(base_path, relative_path)
  12. def resource_path_extend(relative_path):
  13. spath.append(path.abspath(relative_path))
  14. print(sys.path)