【发布时间】:2019-10-30 13:22:54
【问题描述】:
这是我的文件结构:
requirements.txt
Procfile
Chess/
-- lichess-bot/
-- lichess-bot.py
-- config.yml
-- (many other files related to lichess-bot.py)
config.py中负责打开YAML的部分:
def load_config(config_file):
with open(config_file) as stream:
try:
CONFIG = yaml.load(stream)
except Exception as e:
print("There appears to be a syntax problem with your config.yml")
raise e
lichess-bot.py 这里是config.yml 的电话:
CONFIG = load_config(args.config or "./config.yml")
我需要执行的命令是
chmod +x ./engines/stockfish_10_x64python lichess-bot.py -u
我在 Heroku bash 中试过这个:python ./chess/lichess-bot/lichess-bot.py -u 但它返回了
FileNotFoundError: [Errno 2] 没有这样的文件或目录:'./config.yml'
我试过这个Procfile:
worker: cd chess
worker: cd lichess-bot
worker: chmod +x ./engines/stockfish_10_x64
worker: python lichess-bot.py -u
但 Heroku 无法识别它。
如果我手动执行此操作:
~ $ cd chess
~/chess cd lichess-bot
~/chess/lichess-bot python lichess-bot.py -u
效果很好
如何从Procfile访问目录,然后执行文件不出错?
【问题讨论】:
-
问题不是你想的那样。您如何尝试使用
config.yml?请edit您的问题并显示您的代码部分。 -
(另外,请注意
Chess≠chess。但我认为您问题中带有大写字母的那个是错字,这与您的问题无关。) -
-
我现在将使用配置编辑问题
-
看看你提到的repo,你似乎已经添加了两个额外的目录嵌套级别。你为什么这样做?
标签: python heroku procfile lichess