My issue is that i can wrap the .py in bash and run it from the command line using ./run.sh but when i have tried to create a cron job from this i recieve the error:
Traceback (most recent call last):
File "/home/pi/TwitterFollowBot/tweetbot.py", line 3, in
my_bot = TwitterBot()
File "/home/pi/TwitterFollowBot/TwitterFollowBot/init.py", line 42, in init
self.bot_setup(config_file)
File "/home/pi/TwitterFollowBot/TwitterFollowBot/init.py", line 78, in bot_setup
with open(config_file, "r") as in_file:
IOError: [Errno 2] No such file or directory: 'config.txt'
bash script:
Running from the command line invokes the config file as expected and produces my required outcome. Running a cronjob does not.
run.sh has been made an executable so has config.txt out of sheer desperation.
Does anyone have any idea why this issue would happen?
My issue is that i can wrap the .py in bash and run it from the command line using ./run.sh but when i have tried to create a cron job from this i recieve the error: Traceback (most recent call last): File "/home/pi/TwitterFollowBot/tweetbot.py", line 3, in
my_bot = TwitterBot()
File "/home/pi/TwitterFollowBot/TwitterFollowBot/init.py", line 42, in init
self.bot_setup(config_file)
File "/home/pi/TwitterFollowBot/TwitterFollowBot/init.py", line 78, in bot_setup
with open(config_file, "r") as in_file:
IOError: [Errno 2] No such file or directory: 'config.txt'
bash script:
!/bin/bash
/usr/bin/python /home/pi/TwitterFollowBot/tweetbot.py
cronjob: /1 * python /home/pi/TwitterFollowBot/tweetbot.py >> /home/pi/python.log 2>&1
config.txt: OAUTH_TOKEN:example OAUTH_SECRET:example CONSUMER_KEY:example CONSUMER_SECRET:example TWITTER_HANDLE:example ALREADY_FOLLOWED_FILE:already-followed.txt FOLLOWERS_FILE:followers.txt FOLLOWS_FILE:following.txt USERS_KEEP_FOLLOWING: USERS_KEEP_UNMUTED: USERS_KEEP_MUTED: FOLLOW_BACKOFF_MIN_SECONDS:10 FOLLOW_BACKOFF_MAX_SECONDS:60
Running from the command line invokes the config file as expected and produces my required outcome. Running a cronjob does not. run.sh has been made an executable so has config.txt out of sheer desperation.
Does anyone have any idea why this issue would happen?