resource.py 543 B

123456789101112131415161718192021222324252627
  1. #!/usr/bin/env python
  2. # -*- encoding: utf-8 -*-
  3. '''
  4. @文件 :resourcePath.py
  5. @时间 :2021/12/09 13:49:58
  6. @作者 :None
  7. @版本 :1.0
  8. @说明 :资源文件路径配置
  9. '''
  10. from os import path
  11. import sys
  12. from sys import path as spath
  13. def resource_path(relative_path):
  14. try:
  15. base_path = sys._MEIPASS
  16. except Exception:
  17. base_path = path.abspath(".")
  18. return path.join(base_path, relative_path)
  19. def resource_path_extend(relative_path):
  20. spath.append(path.abspath(relative_path))
  21. print(sys.path)