Jun-29-2024, 06:20 AM
Good idea,when i test on Windows and also on Linux(where i have Python installed bye pyenv).
There is Paths problems to where it find Python version used,on Windows i did tests with virtual environment(venv).
My default root Python is(C:\Python312) and virtual environment Path used now is G:\div_code\goose_env\Scripts\python.
On Linux where i use pyenv it guess wrong Path to Python version used.
I think your approach where it need to find path to user Python version can be tricky🔨 to get right.
Example if use configparser it work fine in a venv,as it only care about the path to eg
There is Paths problems to where it find Python version used,on Windows i did tests with virtual environment(venv).
Output:G:\div_code\goose_env
(goose_env) λ python -m configoose conf --marina G:\div_code\goose_env
Traceback (most recent call last):
File "<frozen runpy>", line 198, in _run_module_as_main
File "<frozen runpy>", line 88, in _run_code
File "G:\div_code\goose_env\Lib\site-packages\configoose\__main__.py", line 210, in <module>
main(sys.argv[1:])
File "G:\div_code\goose_env\Lib\site-packages\configoose\util\algorithm.py", line 21, in __call__
return instance.run(*args)
^^^^^^^^^^^^^^^^^^^
File "G:\div_code\goose_env\Lib\site-packages\configoose\__main__.py", line 79, in run
callback(command, args[1:])
File "G:\div_code\goose_env\Lib\site-packages\configoose\cli\subcommand\conf.py", line 71, in main
dest.write_text(code)
File "C:\python312\Lib\pathlib.py", line 1047, in write_text
with self.open(mode='w', encoding=encoding, errors=errors, newline=newline) as f:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\python312\Lib\pathlib.py", line 1013, in open
return io.open(self, mode, buffering, encoding, errors, newline)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'C:\\Users\\Tom\\AppData\\Roaming\\Python\\Python312\\site-packages\\configooseconf.py'
So it goes out of venv and try find path to Python(i have never used .....Roaming\\Python\\Python312\\site-packages) as path.My default root Python is(C:\Python312) and virtual environment Path used now is G:\div_code\goose_env\Scripts\python.
On Linux where i use pyenv it guess wrong Path to Python version used.
I think your approach where it need to find path to user Python version can be tricky🔨 to get right.
Example if use configparser it work fine in a venv,as it only care about the path to eg
example.ini
file.