简体   繁体   中英

Crontab doesn't have permission to read a file

i need to calculate the percentage difference between yesterday bitcoin price and current price.

I have a python script and the current price is given by:

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

but i don't know how to get yesterday price. The only way that i found is saving the current price in a txt file and updating it every day. The problem is with crontab that doesn't have the access to the file and can't read this line.

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

how can i fix this?

chmod a+r yesprice.txt Should do the trick.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM