Heroku - > Python:使用子进程启动可执行文件获取[Permission Denied]

时间:2017-06-20 22:52:58

标签: python heroku chess python-chess

问题:

我在heroku上运行了一个python webapp,它创建了一个与Stockfish国际象棋引擎进行通信的子进程。

我本地计算机上的所有 JustWorks™,但在尝试在Heroku上部署项目时,我收到错误PermissionError: [Errno 13] Permission denied

下面,我在尝试部署时包含了heroku日志。

我知道其他人都有heroku应用程序在同一个dyno中运行stockfish引擎,但是我没有多少运气找到资源来帮助我让它工作。任何帮助表示赞赏。谢谢!


日志:

bash 2017-06-20T22:32:48.419694+00:00 heroku[web.1]: Starting process with command `python server.py` 2017-06-20T22:32:51.933668+00:00 app[web.1]: Traceback (most recent call last): 2017-06-20T22:32:51.933687+00:00 app[web.1]: File "server.py", line 23, in <module> 2017-06-20T22:32:51.933882+00:00 app[web.1]: engine = chess.uci.popen_engine(DIR_PATH + "/stockfish_8_x64") 2017-06-20T22:32:51.933884+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/chess/uci.py", line 1405, in popen_engine 2017-06-20T22:32:51.934623+00:00 app[web.1]: PopenProcess(engine, command, **kwargs) 2017-06-20T22:32:51.934625+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/site-packages/chess/uci.py", line 404, in __init__ 2017-06-20T22:32:51.934874+00:00 app[web.1]: self.process = subprocess.Popen(command, **popen_args) 2017-06-20T22:32:51.934877+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/subprocess.py", line 707, in __init__ 2017-06-20T22:32:51.935286+00:00 app[web.1]: restore_signals, start_new_session) 2017-06-20T22:32:51.935288+00:00 app[web.1]: File "/app/.heroku/python/lib/python3.6/subprocess.py", line 1326, in _execute_child 2017-06-20T22:32:51.935988+00:00 app[web.1]: raise child_exception_type(errno_num, err_msg) 2017-06-20T22:32:51.936008+00:00 app[web.1]: PermissionError: [Errno 13] Permission denied 2017-06-20T22:32:52.051035+00:00 heroku[web.1]: State changed from starting to crashed 2017-06-20T22:32:52.035235+00:00 heroku[web.1]: Process exited with status 1

1 个答案:

答案 0 :(得分:0)

根据评论回答我自己的问题: 鳕鱼可执行文件在heroku服务器上没有可执行权限,需要明确添加。根据对原始问题的评论中的指导,我能够修改我的server.py以将可执行权限附加到stockfish可执行文件。

Source -> SO: Simple chmod +x in python