Ask coding questions

← Back to all posts
What is the problem?
AhmadNasser2 (0)

When I use "pip install googletrans==3.1.0a0" in the shell it works very well, but later on after couple hours it doesn't work anymore. so I need to rewrite it again and again.

Answered by VulcanWM (2906) [earned 5 cycles]
View Answer
Comments
hotnewtop
VulcanWM (2906)

Yeah you need to install it every few hours
If you want it to do that every time you restart the code, do the code:
import os
os.system(“pip install googletrans=3.1.0a0”)

AhmadNasser2 (0)

Thank [email protected], sorry im new on replit, is there a way to let it restarting woth me logging every hour?

VulcanWM (2906)

So you want it to restart every hour? @AhmadNasser2

AhmadNasser2 (0)

Yes or whatever googletrans stop working, because its needed 😇@VulcanWM

VulcanWM (2906)

Do something like https://replit.com/@VulcanWM/Drinks-Cabin-Hourly#main.py with the apscheduler.schedulers.background.BackgroundScheduler @AhmadNasser2

AhmadNasser2 (0)

is it possible to use :
--- my code ---
Time.sleep(3600)
os.system('python main.py') @VulcanWM :)

VulcanWM (2906)

But that won’t stay alive 24/7 @AhmadNasser2

AhmadNasser2 (0)

oh, what about this

def job():

#   print('running')
#   os.system("pip install googletrans==3.1.0a0")
#   os.system("pip install --upgrade pip")

# if __name__=='__main__':
# 
#   sched = BackgroundScheduler(timezone='MST')
#   sched.add_job(job, 'interval', id='an_hour', seconds=3600)
#   sched.start()

@VulcanWM

VulcanWM (2906)

Try adding a web server to that so you can add uptimerobot to the url so then it will stay online 24/7
or you can get hacker plan and turn on the always on option for the repl you’re doing all the code on
@AhmadNasser2

AhmadNasser2 (0)

hi, thanks for all helping.
Yes Im using uptime robot.

@VulcanWM

VulcanWM (2906)

np if it helped just mark the comment as the answer :) @AhmadNasser2