【问题标题】:Crontab doesn't have permission to read a filecrontab 没有读取文件的权限
【发布时间】:2020-05-02 06:30:33
【问题描述】:

我需要计算昨天比特币价格和当前价格之间的百分比差异。

我有一个 python 脚本,当前价格由以下给出:

 response = requests.get('http://api.coindesk.com/v1/bpi/currentprice.json')

但我不知道如何获得昨天的价格。我发现的唯一方法是将当前价格保存在 txt 文件中并每天更新。问题在于 crontab 无权访问该文件并且无法读取此行。

file = open("yesprice.txt", "r")

我该如何解决这个问题?

【问题讨论】:

    标签: python linux cron


    【解决方案1】:

    chmod a+r yesprice.txt 应该可以解决问题。

    【讨论】:

      猜你喜欢
      • 2019-12-27
      • 1970-01-01
      • 2013-11-27
      • 2016-05-07
      • 2018-09-21
      • 2011-02-22
      • 2013-05-17
      • 2016-04-14
      • 2017-02-12
      相关资源
      最近更新 更多