但仍拒绝生成提示命令

2024-05-05 02:15:23 发布

您现在位置:Python中文网/ 问答频道 /正文

我在做一个开源项目。特别是this one。在

readme.md中,它基本上是说为了开始,做一个名为learntris.py的空程序。第一步是指示命令行定位learntris.py文件。在

更深入地解释了here。在

我使用了成功的语法来定位文件并生成输出,但我认为这里有一个问题。根据this page的预期输出如下:

Running test 1: io.q
q : quit
---- sending commands ----
q
---- awaiting results ----
Test 1 passed


Running test 2: io.p
p : print
---- sending commands ----
p
q
---- awaiting results ----
: The 'p' command instructs learntris to print the state
: of the Matrix, the rectangular array of cells in which
: blocks can appear.
:
: The Matrix is 10 cells wide and 22 cells deep, although
: the top two rows are used only for spawning new Tetraminos.
:
: At the start of the game, the Matrix should be empty.
: The 'p' command should indicate empty cells with the
: '.' character.
:
: Cells should be separated by spaces.
:
: Lines should be separated by the standard end of line
: sequence on your operating system (python's "\n").

接下来是剩下的输出。当我运行learntris.py文件时,我得到的输出完全相同,但只有一个键不同。它说在打印出p commands...部分之前,权限被拒绝。在

^{pr2}$

那么为什么这个许可被拒绝了,这对我的输出有什么影响呢?在


Tags: 文件ofthepy定位testbethis
1条回答
网友
1楼 · 发布于 2024-05-05 02:15:23

你运行测试脚本testris.py(你在问题中没有透露这一点,所以我不确定指令是不完整的还是你没有完全遵循它们)要求你在测试真正成功运行你的程序之前做chmod +x ./learntris.py。在

您只需执行一次,只要不从磁盘中删除文件,即使您编辑或以其他方式修改它,execute权限就会保留在那里。在

相关问题 更多 >