EduardKononov / from-root

A Python package that helps you create paths relative to the project root
MIT License
15 stars 1 forks source link

after using pyinstaller, from-root does not work #2

Open damnmso opened 1 year ago

damnmso commented 1 year ago

when using pyinstaller, from-root seems to be not able to find the .project_root

FileNotFoundError: No possible anchors found (.git, .project-root), cannot detect root folder. Initialize a git repository or create an empty ".project-root" file in the project root

PS C:\Users\xx.xx\Desktop\app> .\app.exe
WORKING IN: C:\Users\xx.xx\Desktop\app
Traceback (most recent call last):
  File "app.py", line 11, in <module>
  File "adapters\gui\gui_app.py", line 15, in run
  File "applicationconfiguration.py", line 14, in getBusinessObject
  File "business\credfilehelper.py", line 10, in createCredFileIfNotExists
  File "from_root\root.py", line 24, in from_root
  File "from_root\get_project_root.py", line 23, in get_project_root
FileNotFoundError: No possible anchors found (.git, .project-root), cannot detect root folder. Initialize a git repository or create an empty ".project-root" file in the project root
[2192] Failed to execute script 'app' due to unhandled exception!
PS C:\Users\xx.xx\Desktop\app> ls .\.project_root

    Verzeichnis: C:\Users\xx.xx\Desktop\app

Mode                 LastWriteTime         Length Name
----                 -------------         ------ ----
-a----        23.05.2023     09:07             27 .project_root

this was from powershells command line, so even if the path should be correct, seems like its not i added a print os.getcwd() just to be sure

EduardKononov commented 1 year ago

This is what I get on MacOS:

(base) ekon@mb-pro issue % cat __main__.py
from from_root import from_root

print(from_root())

(base) ekon@mb-pro issue % ./__main__    # this is a pyinstalled __main__.py
Traceback (most recent call last):
  File "proj/__main__.py", line 3, in <module>
  File "from_root/root.py", line 24, in from_root
  File "from_root/get_project_root.py", line 23, in get_project_root
FileNotFoundError: No possible anchors found (.git, .project-root), cannot detect root folder. Initialize a git repository or create an empty ".project-root" file in the project root
[90869] Failed to execute script '__main__' due to unhandled exception!

(base) ekon@mb-pro issue % touch .project-root

(base) ekon@mb-pro issue % ./__main__
/Users/ekon/Desktop/issue

It might be something Windows specific. Don't have a win pc now. Feel free to contribute, if you wish :)