pip包安装后运行失败(使用诗歌)
我正在使用诗歌我的项目有一棵树:
https://i.sstatic.net/PSJfI.png
我的代码中有这样的路径:
SPACESHIP_FRAMES = (
'space_game/frames/rocket/rocket_frame_1.txt',
'space_game/frames/rocket/rocket_frame_2.txt',
)
当我将程序作为诗歌脚本运行时,一切正常:space-game = "space_game.game:main"
和简单的 python 脚本。
但!当我尝试在将游戏安装为 pip 包后运行 space-game
时,我看到:
FileNotFoundError: [Errno 2] No such file or directory: 'space_game/frames/rocket/rocket_frame_1.txt'
How should I edit path to txt or pyproject.toml?
我尝试了不同的方法来写入 txt 文件的路径,但没有任何帮助。
I am using poetry There is a tree of my project:
https://i.sstatic.net/PSJfI.png
I have such paths in my code:
SPACESHIP_FRAMES = (
'space_game/frames/rocket/rocket_frame_1.txt',
'space_game/frames/rocket/rocket_frame_2.txt',
)
Everything is working when I run my programm both as poetry script: space-game = "space_game.game:main"
and as simple python script.
But! When I try to run space-game
after installation game as pip package I see:
FileNotFoundError: [Errno 2] No such file or directory: 'space_game/frames/rocket/rocket_frame_1.txt'
How should I modify path to txt or pyproject.toml?
I tried different ways to write paths to txt files but nothing helped.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。

绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论