where do print statements go after being deployed?

hi, do print statements print the deploy logs? and if so is there any special variable i have to activate to ensure it prints or will it print in every case?
29 Replies
Percy
Percy13mo ago
Project ID: b5b8b5dd-ede7-45e7-93a7-4b369707abc8
jimbobjunior
jimbobjuniorOP13mo ago
b5b8b5dd-ede7-45e7-93a7-4b369707abc8
Brody
Brody13mo ago
as long as you are printing unbuffered to stdout / stderr the logs will show in the deployment logs
jimbobjunior
jimbobjuniorOP13mo ago
do you happen to know why none of the print statements in teh following code are being printed in teh deploy logs?
jimbobjunior
jimbobjuniorOP13mo ago
No description
jimbobjunior
jimbobjuniorOP13mo ago
this is my build log:
No description
Brody
Brody13mo ago
not really, but why is your code pushing itself to github?
jimbobjunior
jimbobjuniorOP13mo ago
because i want to update the code daily - i have a function called scrapeNews which I've commented out which will change the code base. i then want to push it every day the overarching issue is that its not seeming to push to github and im trying to figure out why - hence wanting print statements. i know my script is fine because when i run it locally it pushes to github + prints everything
Brody
Brody13mo ago
how about just use a database, you should not be doing what you're doing, it's extremely bad practice
jimbobjunior
jimbobjuniorOP13mo ago
why is it bad practice?
Brody
Brody13mo ago
your code updating its own github repo, you are asking for trouble
jimbobjunior
jimbobjuniorOP13mo ago
yes i see, i will move to a database later but i just want to get a functioning prototype for now and this is the last step
Brody
Brody13mo ago
alright is that function is ran by the cron scheduler and only cron?
jimbobjunior
jimbobjuniorOP13mo ago
yeah
Brody
Brody13mo ago
then its only gonna be ran at that time, in the utc timezone
jimbobjunior
jimbobjuniorOP13mo ago
yeah but its not running or if it is its not pushing to github but it works completely when i run it locally which is why im confused
Brody
Brody13mo ago
is it 11:46 UTC yet? the times you see here are not UTC
jimbobjunior
jimbobjuniorOP13mo ago
yes the time is correct i know this because i run it locally like a minute before and it works
Brody
Brody13mo ago
do you live in the UTC timezone?
jimbobjunior
jimbobjuniorOP13mo ago
no but the time is not the issue because i had deployed this code and left it up for an entire month while i was working on other projects... the function never ran
Brody
Brody13mo ago
oh i know!! you start the schedular inside this if block if __name__ == "__main__": but you are using gunicorn (good) when using gunicorn __name__ will not equal "__main__" so the scheduler will never start, start the scheduler outside of that if block
jimbobjunior
jimbobjuniorOP13mo ago
let me try that!
Brody
Brody13mo ago
still keep the timezone stuff in mind tho, that stuff is still valid
jimbobjunior
jimbobjuniorOP13mo ago
you were right once i moved the scheduler outside main it worked but i think there are major issues getting the git commands to work on the deployed machine... keeps saying directory isnt a git repo... i will look at moving teh content to a database
Brody
Brody13mo ago
it's not a git repo because there's no .git folder, this is automatically omitted when you push the repo to github
jimbobjunior
jimbobjuniorOP13mo ago
is there any way aruond this?
Brody
Brody13mo ago
nope, that's how github works please for your own sake, store the data in a database
jimbobjunior
jimbobjuniorOP13mo ago
hahaha alright thanks for all your help
Brody
Brody13mo ago
no problem!
Want results from more Discord servers?
Add your server