在命令提示符下拒绝权限但仍生成输出

时间:2018-03-07 19:26:57

标签: python python-2.7 shell command-line

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

readme.md它基本上说要开始,请创建一个名为learntris.py的空程序。第一步是指示命令行找到learntris.py文件。

深入解释here

我使用成功的语法来定位文件并生成输出,但在这里我认为存在问题。根据{{​​3}}的预期输出是:

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...部分之前拒绝了许可。

Running test 1: io.q
q : quit
---- sending commands ----
q
---- awaiting results ----
/bin/sh: ./learntris.py: Permission denied
Test 1 passed


Running test 2: io.p
p : print
---- sending commands ----
p
q
---- awaiting results ----
/bin/sh: ./learntris.py: Permission denied
: 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").

那么为什么拒绝许可以及这会对我的输出产生什么样的影响呢?

1 个答案:

答案 0 :(得分:1)

您运行测试脚本的方式chmod +x ./learntris.py(您在问题中没有透露这一点,因此我不确定说明是否不完整,或者您是否未完全遵循这些说明)要求您在测试实际成功运行程序之前执行Msg 1776, Level 16, State 0, Line 1 There are no primary or candidate keys in the referenced table 'XYZCODES' that match the referencing column list in the foreign key 'FK_INDUSTRY_XYZCODES'. Msg 1750, Level 16, State 1, Line 1 Could not create constraint or index. See previous errors.

您只需执行此操作一次,只要您不从磁盘中删除该文件,执行权限就会保留在那里,即使您编辑或修改它也是如此。