PS C:\Git\LaoshuBaby\liulianmao\src\liulianmao> py __main__.py -s zhipu -fa
Traceback (most recent call last):
File "C:\Git\LaoshuBaby\liulianmao\src\liulianmao\__main__.py", line 7, in <module>
LIULIANMAO_VERSION = toml.load("pyproject.toml")["tool"]["poetry"]["version"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Environment\Python\Python311\Lib\site-packages\toml\decoder.py", line 133, in load
with io.open(_getpath(f), encoding='utf-8') as ffile:
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
FileNotFoundError: [Errno 2] No such file or directory: 'pyproject.toml'
在 @Ovler-Young 的 https://github.com/LaoshuBaby/liulianmao/commit/f9b89c9aa93bee1a85dacb2bb3732c9ecc85627d 之后
而切换到
/
目录下这里我能想到的方法就是通过
__file__
构造绝对路径然后一层一层定位到上面的pyproject.toml
(此外这样还有一个问题,如果打包的话,
pyproject.toml
应该是打包不进site-packages
的)我暂时把它cherry pick到 review_suggestion 分支了,因为 @boholder 老师之前也提到了这个问题 https://github.com/LaoshuBaby/liulianmao/blob/5e98a1ce7a8565753f8afe493547f0a91b64672e/pyproject.toml#L3-L7 所以作为苟管理,我建议还是慢慢修(然后main分支上我先退掉了不然run都run不起来了)