Python script not running correctly when launched with crontab The 2019 Stack Overflow Developer Survey Results Are In Unicorn Meta Zoo #1: Why another podcast? Announcing the arrival of Valued Associate #679: Cesar Manara Congratulation Joan for 50k!Error when attempting to create Python GUI using Tkinter: “no display name and no $DISPLAY environment variable”raspberry pi2 photogateCrontab on Rpi not running Python scriptPython3 flagging 'async def' as invalid syntaxCrontab task not running script - Permissions?Lighttpd running FastCGI script hangs and give 500 internal errorRun python script from phpPython script not running when added to crontabPython script not running on start upUnable to run python script on boot

Visa regaring travelling European country

Can I visit the Trinity College (Cambridge) library and see some of their rare books

How do I design a circuit to convert a 100 mV and 50 Hz sine wave to a square wave?

Why can't wing-mounted spoilers be used to steepen approaches?

How did the audience guess the pentatonic scale in Bobby McFerrin's presentation?

My body leaves; my core can stay

Is there a way to generate uniformly distributed points on a sphere from a fixed amount of random real numbers per point?

Mortgage adviser recommends a longer term than necessary combined with overpayments

Why can't devices on different VLANs, but on the same subnet, communicate?

Single author papers against my advisor's will?

How to type a long/em dash `—`

Are there continuous functions who are the same in an interval but differ in at least one other point?

Is this wall load bearing? Blueprints and photos attached

What force causes entropy to increase?

Button changing its text & action. Good or terrible?

Am I ethically obligated to go into work on an off day if the reason is sudden?

How did passengers keep warm on sail ships?

One-dimensional Japanese puzzle

ELI5: Why do they say that Israel would have been the fourth country to land a spacecraft on the Moon and why do they call it low cost?

Do warforged have souls?

How to determine omitted units in a publication

Huge performance difference of the command find with and without using %M option to show permissions

Loose spokes after only a few rides

Variable with quotation marks "$()"



Python script not running correctly when launched with crontab



The 2019 Stack Overflow Developer Survey Results Are In
Unicorn Meta Zoo #1: Why another podcast?
Announcing the arrival of Valued Associate #679: Cesar Manara
Congratulation Joan for 50k!Error when attempting to create Python GUI using Tkinter: “no display name and no $DISPLAY environment variable”raspberry pi2 photogateCrontab on Rpi not running Python scriptPython3 flagging 'async def' as invalid syntaxCrontab task not running script - Permissions?Lighttpd running FastCGI script hangs and give 500 internal errorRun python script from phpPython script not running when added to crontabPython script not running on start upUnable to run python script on boot



.everyoneloves__top-leaderboard:empty,.everyoneloves__mid-leaderboard:empty,.everyoneloves__bot-mid-leaderboard:empty margin-bottom:0;








4















I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly.



python3 /home/pi/Documents/telegrambot.py


The problem occurs when I set the program to start on boot.



sudo crontab -e
[last line] @reboot sudo python3 /home/pi/Documents/telegrambot.py &


I know that the code is running because I set the bot to send me "I'm online" and it answer me if the reply isn't related to sending images... but when I send to it /tempgraph, it should answer with the the picture of its readings.
But I only get the sensor's name and no image at all.



...
chatHist = readCommandHistory(db,chat_id,1)
lastCommand = chatHist[0]['msg']
choice = command.split(".")
if command in lastCommand and len(choice) <= 2:
Fonte = re.search('(s|n)'+str(command.split('.')[0])+')s(.*)', lastCommand).group(2)
bot.sendMessage(chat_id, Fonte) #this works
if len(choice) == 1:
table = sdc.readTableServer(db, senstable, 'Fonte', Fonte)
for sensor in table.Sensor.unique():
bot.sendMessage(chat_id, sensor)
tbl = table[table.Sensor == sensor]
#until here everything is ok
for ts in tiposensores:
try:
gop.plotSetup(tbl[['Data',ts]])
#save the image in the folter ... Images/Imagem.png,
#but only works when not on stratup...
bot.sendPhoto(chat_id,open('/home/pi/Documents/Images/Imagem.png','rb'))
pif.cleanImages()
except OSError:
pass


...



@edit:



I found out that the problem happens after i call



gop.plotSetup(tbl[['Data',ts]]) 


inside the plotSetup function, in this step:



f= plt.figure(figsize=(12, 9))


This is the first time that i use the variable f inside the function.



@edit2



As I said before, the error happens in the plt.figure.



THis is the gpo.plotSetup(), with some changes to catch the error as instructed:



def plotSetup(Data):
...[some code here]...
with open("/home/pi/Desktop/log.csv","a+") as o:
fop.writeCSVFile(o, ['before first plt.figure'])

try:
f= plt.figure(figsize=(12, 9))
except IOError as e:
fop.writeCSVFile(o, e)
except:
for e in sys.exc_info():
fop.writeCSVFile(o, e)

...[some code here]...
f.savefig("/home/pi/Documents/Images/Imagem.png", bbox_inches="tight")


and i got this errors:



<class '_tkinter.TclError'>
no display name and no $DISPLAY environment variable
<traceback object at 0x6e3c8d50>


@edit3



That error led me to this post:



_tkinter.TclError: no display name and no $DISPLAY environment variable



this post suggested use this in the very beginning of the code:



import matplotlib
matplotlib.use('Agg')


and then VOILA!! It's alive.



Really appreciate all the help that you guys gave me, thanks! ;p










share|improve this question
























  • Does this gop.PlotSetup generate a picture and store it on disk?

    – Mark Smith
    Mar 24 at 13:18











  • Edit the crontab without "sudo": $ crontab -e

    – Benyamin Jafari
    Mar 24 at 16:54












  • @MarkSmith, yeah it does! I'll add the last line of this function in the post.

    – SWoto
    Mar 24 at 17:31











  • @BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

    – SWoto
    Mar 24 at 17:37











  • Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

    – Pedro Lobito
    Mar 24 at 21:38


















4















I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly.



python3 /home/pi/Documents/telegrambot.py


The problem occurs when I set the program to start on boot.



sudo crontab -e
[last line] @reboot sudo python3 /home/pi/Documents/telegrambot.py &


I know that the code is running because I set the bot to send me "I'm online" and it answer me if the reply isn't related to sending images... but when I send to it /tempgraph, it should answer with the the picture of its readings.
But I only get the sensor's name and no image at all.



...
chatHist = readCommandHistory(db,chat_id,1)
lastCommand = chatHist[0]['msg']
choice = command.split(".")
if command in lastCommand and len(choice) <= 2:
Fonte = re.search('(s|n)'+str(command.split('.')[0])+')s(.*)', lastCommand).group(2)
bot.sendMessage(chat_id, Fonte) #this works
if len(choice) == 1:
table = sdc.readTableServer(db, senstable, 'Fonte', Fonte)
for sensor in table.Sensor.unique():
bot.sendMessage(chat_id, sensor)
tbl = table[table.Sensor == sensor]
#until here everything is ok
for ts in tiposensores:
try:
gop.plotSetup(tbl[['Data',ts]])
#save the image in the folter ... Images/Imagem.png,
#but only works when not on stratup...
bot.sendPhoto(chat_id,open('/home/pi/Documents/Images/Imagem.png','rb'))
pif.cleanImages()
except OSError:
pass


...



@edit:



I found out that the problem happens after i call



gop.plotSetup(tbl[['Data',ts]]) 


inside the plotSetup function, in this step:



f= plt.figure(figsize=(12, 9))


This is the first time that i use the variable f inside the function.



@edit2



As I said before, the error happens in the plt.figure.



THis is the gpo.plotSetup(), with some changes to catch the error as instructed:



def plotSetup(Data):
...[some code here]...
with open("/home/pi/Desktop/log.csv","a+") as o:
fop.writeCSVFile(o, ['before first plt.figure'])

try:
f= plt.figure(figsize=(12, 9))
except IOError as e:
fop.writeCSVFile(o, e)
except:
for e in sys.exc_info():
fop.writeCSVFile(o, e)

...[some code here]...
f.savefig("/home/pi/Documents/Images/Imagem.png", bbox_inches="tight")


and i got this errors:



<class '_tkinter.TclError'>
no display name and no $DISPLAY environment variable
<traceback object at 0x6e3c8d50>


@edit3



That error led me to this post:



_tkinter.TclError: no display name and no $DISPLAY environment variable



this post suggested use this in the very beginning of the code:



import matplotlib
matplotlib.use('Agg')


and then VOILA!! It's alive.



Really appreciate all the help that you guys gave me, thanks! ;p










share|improve this question
























  • Does this gop.PlotSetup generate a picture and store it on disk?

    – Mark Smith
    Mar 24 at 13:18











  • Edit the crontab without "sudo": $ crontab -e

    – Benyamin Jafari
    Mar 24 at 16:54












  • @MarkSmith, yeah it does! I'll add the last line of this function in the post.

    – SWoto
    Mar 24 at 17:31











  • @BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

    – SWoto
    Mar 24 at 17:37











  • Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

    – Pedro Lobito
    Mar 24 at 21:38














4












4








4


1






I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly.



python3 /home/pi/Documents/telegrambot.py


The problem occurs when I set the program to start on boot.



sudo crontab -e
[last line] @reboot sudo python3 /home/pi/Documents/telegrambot.py &


I know that the code is running because I set the bot to send me "I'm online" and it answer me if the reply isn't related to sending images... but when I send to it /tempgraph, it should answer with the the picture of its readings.
But I only get the sensor's name and no image at all.



...
chatHist = readCommandHistory(db,chat_id,1)
lastCommand = chatHist[0]['msg']
choice = command.split(".")
if command in lastCommand and len(choice) <= 2:
Fonte = re.search('(s|n)'+str(command.split('.')[0])+')s(.*)', lastCommand).group(2)
bot.sendMessage(chat_id, Fonte) #this works
if len(choice) == 1:
table = sdc.readTableServer(db, senstable, 'Fonte', Fonte)
for sensor in table.Sensor.unique():
bot.sendMessage(chat_id, sensor)
tbl = table[table.Sensor == sensor]
#until here everything is ok
for ts in tiposensores:
try:
gop.plotSetup(tbl[['Data',ts]])
#save the image in the folter ... Images/Imagem.png,
#but only works when not on stratup...
bot.sendPhoto(chat_id,open('/home/pi/Documents/Images/Imagem.png','rb'))
pif.cleanImages()
except OSError:
pass


...



@edit:



I found out that the problem happens after i call



gop.plotSetup(tbl[['Data',ts]]) 


inside the plotSetup function, in this step:



f= plt.figure(figsize=(12, 9))


This is the first time that i use the variable f inside the function.



@edit2



As I said before, the error happens in the plt.figure.



THis is the gpo.plotSetup(), with some changes to catch the error as instructed:



def plotSetup(Data):
...[some code here]...
with open("/home/pi/Desktop/log.csv","a+") as o:
fop.writeCSVFile(o, ['before first plt.figure'])

try:
f= plt.figure(figsize=(12, 9))
except IOError as e:
fop.writeCSVFile(o, e)
except:
for e in sys.exc_info():
fop.writeCSVFile(o, e)

...[some code here]...
f.savefig("/home/pi/Documents/Images/Imagem.png", bbox_inches="tight")


and i got this errors:



<class '_tkinter.TclError'>
no display name and no $DISPLAY environment variable
<traceback object at 0x6e3c8d50>


@edit3



That error led me to this post:



_tkinter.TclError: no display name and no $DISPLAY environment variable



this post suggested use this in the very beginning of the code:



import matplotlib
matplotlib.use('Agg')


and then VOILA!! It's alive.



Really appreciate all the help that you guys gave me, thanks! ;p










share|improve this question
















I'm running a telegram bot on my Raspberry Pi 3. When I run it in my console or using Thonny, everything runs smoothly.



python3 /home/pi/Documents/telegrambot.py


The problem occurs when I set the program to start on boot.



sudo crontab -e
[last line] @reboot sudo python3 /home/pi/Documents/telegrambot.py &


I know that the code is running because I set the bot to send me "I'm online" and it answer me if the reply isn't related to sending images... but when I send to it /tempgraph, it should answer with the the picture of its readings.
But I only get the sensor's name and no image at all.



...
chatHist = readCommandHistory(db,chat_id,1)
lastCommand = chatHist[0]['msg']
choice = command.split(".")
if command in lastCommand and len(choice) <= 2:
Fonte = re.search('(s|n)'+str(command.split('.')[0])+')s(.*)', lastCommand).group(2)
bot.sendMessage(chat_id, Fonte) #this works
if len(choice) == 1:
table = sdc.readTableServer(db, senstable, 'Fonte', Fonte)
for sensor in table.Sensor.unique():
bot.sendMessage(chat_id, sensor)
tbl = table[table.Sensor == sensor]
#until here everything is ok
for ts in tiposensores:
try:
gop.plotSetup(tbl[['Data',ts]])
#save the image in the folter ... Images/Imagem.png,
#but only works when not on stratup...
bot.sendPhoto(chat_id,open('/home/pi/Documents/Images/Imagem.png','rb'))
pif.cleanImages()
except OSError:
pass


...



@edit:



I found out that the problem happens after i call



gop.plotSetup(tbl[['Data',ts]]) 


inside the plotSetup function, in this step:



f= plt.figure(figsize=(12, 9))


This is the first time that i use the variable f inside the function.



@edit2



As I said before, the error happens in the plt.figure.



THis is the gpo.plotSetup(), with some changes to catch the error as instructed:



def plotSetup(Data):
...[some code here]...
with open("/home/pi/Desktop/log.csv","a+") as o:
fop.writeCSVFile(o, ['before first plt.figure'])

try:
f= plt.figure(figsize=(12, 9))
except IOError as e:
fop.writeCSVFile(o, e)
except:
for e in sys.exc_info():
fop.writeCSVFile(o, e)

...[some code here]...
f.savefig("/home/pi/Documents/Images/Imagem.png", bbox_inches="tight")


and i got this errors:



<class '_tkinter.TclError'>
no display name and no $DISPLAY environment variable
<traceback object at 0x6e3c8d50>


@edit3



That error led me to this post:



_tkinter.TclError: no display name and no $DISPLAY environment variable



this post suggested use this in the very beginning of the code:



import matplotlib
matplotlib.use('Agg')


and then VOILA!! It's alive.



Really appreciate all the help that you guys gave me, thanks! ;p







raspbian pi-3 python boot






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited Mar 25 at 22:47







SWoto

















asked Mar 24 at 13:09









SWotoSWoto

443




443












  • Does this gop.PlotSetup generate a picture and store it on disk?

    – Mark Smith
    Mar 24 at 13:18











  • Edit the crontab without "sudo": $ crontab -e

    – Benyamin Jafari
    Mar 24 at 16:54












  • @MarkSmith, yeah it does! I'll add the last line of this function in the post.

    – SWoto
    Mar 24 at 17:31











  • @BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

    – SWoto
    Mar 24 at 17:37











  • Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

    – Pedro Lobito
    Mar 24 at 21:38


















  • Does this gop.PlotSetup generate a picture and store it on disk?

    – Mark Smith
    Mar 24 at 13:18











  • Edit the crontab without "sudo": $ crontab -e

    – Benyamin Jafari
    Mar 24 at 16:54












  • @MarkSmith, yeah it does! I'll add the last line of this function in the post.

    – SWoto
    Mar 24 at 17:31











  • @BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

    – SWoto
    Mar 24 at 17:37











  • Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

    – Pedro Lobito
    Mar 24 at 21:38

















Does this gop.PlotSetup generate a picture and store it on disk?

– Mark Smith
Mar 24 at 13:18





Does this gop.PlotSetup generate a picture and store it on disk?

– Mark Smith
Mar 24 at 13:18













Edit the crontab without "sudo": $ crontab -e

– Benyamin Jafari
Mar 24 at 16:54






Edit the crontab without "sudo": $ crontab -e

– Benyamin Jafari
Mar 24 at 16:54














@MarkSmith, yeah it does! I'll add the last line of this function in the post.

– SWoto
Mar 24 at 17:31





@MarkSmith, yeah it does! I'll add the last line of this function in the post.

– SWoto
Mar 24 at 17:31













@BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

– SWoto
Mar 24 at 17:37





@BenyaminJafari, tried this too, everything runs in the same way as before (sending pictures still not working) =(

– SWoto
Mar 24 at 17:37













Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

– Pedro Lobito
Mar 24 at 21:38






Debug the python script to a log file and check the errors after booting. Make sure you use chmod -R, recursive.

– Pedro Lobito
Mar 24 at 21:38











4 Answers
4






active

oldest

votes


















4














You have two problems: the problem of the file not being found, and the problem preventing you from debugging the first problem.



First let's make a general improvement. You have



try:
[...]
except OSError e:
pass


This means if the try part fails with OSError, it will just ignore it, tell you nothing about it, and carry on. At very least, log the error:



try:
[...]
except OSError e:
print(e)


Now when it goes wrong you should be able to find out why from the system logs (/var/log/syslog I think).



Now the real problem. I don't know what this gop thing is, and your extract doesn't show it, but you say it generates a file, which you indicate is in Images/Imagem.png -- although I suspect it's really in Documents/Images/Imagem.png. This is a relative path - relative to your current directory. When you load the file in the next line, you use an absolute path - relative to the filesystem root.



When you run the file as user pi you are probably doing so from /home/pi (or ~pi, which is equivalent), your file goes into /home/pi/Documents/Images/Imagem.png, the absolute and relative paths happen to match up, and the next line can find the file. However when you run it from crontab, it will have a different current directory. I don't know offhand what current directory crontab will give it, but there's no way it'll be /home/pi.



Either change gop (whatever that is) to put the file in an absolute location (I don't have the code to help with that), or change your code to read it from the same relative location:



bot.sendPhoto(chat_id,open('Documents/Images/Imagem.png','rb'))


Lastly, unless there is a good reason to run the script as root, don't. It should have the least privilege it requires to work. Just good practice.






share|improve this answer






























    3














    Try this:



    $ sudo chmod 777 /home/pi/Documents/Images 


    After you've done that, re-boot to check if that fixes it.

    If not, try changing your crontab entry to this:



    @reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1)


    You should also consider adding a debug statement to your Python code to collect and save any errors that are thrown during execution.






    share|improve this answer

























    • I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

      – SWoto
      Mar 24 at 17:27












    • @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

      – Seamus
      Mar 24 at 18:22











    • @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

      – SWoto
      Mar 24 at 22:35












    • @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

      – Seamus
      Apr 6 at 0:20


















    2














    This might be a permission problem. When running under the user's (your) credentials it works and when under the crontab's credentials is does not.



    Try a test: WRT to your images, temporarily open permissions to all images files and the associated directory and see if the application works when run by the crontab.



    Don't leave the permissions opened to all as it is a security risk.






    share|improve this answer























    • I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

      – SWoto
      Mar 24 at 17:30











    • There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

      – st2000
      Mar 24 at 21:20











    • just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

      – SWoto
      Mar 24 at 22:45


















    2














    like i said in the last edition that i made in the question...



    After adding the print sentence to some file after the exception, i got this:



    <class '_tkinter.TclError'>
    no display name and no $DISPLAY environment variable
    <traceback object at 0x6e3c8d50>


    Thit error led me to this post:



    _tkinter.TclError: no display name and no $DISPLAY environment variable



    that suggested to use this in the very beginning of the code:



    import matplotlib
    matplotlib.use('Agg')


    and then VOILA!! It's alive.



    Really appreciate all the help that you guys gave me, thanks @Seamus, @Mark Smith and @st2000!! ;p






    share|improve this answer























    • It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

      – Dmitry Grigoryev
      Mar 26 at 8:40











    Your Answer






    StackExchange.ifUsing("editor", function ()
    return StackExchange.using("schematics", function ()
    StackExchange.schematics.init();
    );
    , "cicuitlab");

    StackExchange.ready(function()
    var channelOptions =
    tags: "".split(" "),
    id: "447"
    ;
    initTagRenderer("".split(" "), "".split(" "), channelOptions);

    StackExchange.using("externalEditor", function()
    // Have to fire editor after snippets, if snippets enabled
    if (StackExchange.settings.snippets.snippetsEnabled)
    StackExchange.using("snippets", function()
    createEditor();
    );

    else
    createEditor();

    );

    function createEditor()
    StackExchange.prepareEditor(
    heartbeatType: 'answer',
    autoActivateHeartbeat: false,
    convertImagesToLinks: false,
    noModals: true,
    showLowRepImageUploadWarning: true,
    reputationToPostImages: null,
    bindNavPrevention: true,
    postfix: "",
    imageUploader:
    brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
    contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
    allowUrls: true
    ,
    onDemand: true,
    discardSelector: ".discard-answer"
    ,immediatelyShowMarkdownHelp:true
    );



    );













    draft saved

    draft discarded


















    StackExchange.ready(
    function ()
    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f95726%2fpython-script-not-running-correctly-when-launched-with-crontab%23new-answer', 'question_page');

    );

    Post as a guest















    Required, but never shown

























    4 Answers
    4






    active

    oldest

    votes








    4 Answers
    4






    active

    oldest

    votes









    active

    oldest

    votes






    active

    oldest

    votes









    4














    You have two problems: the problem of the file not being found, and the problem preventing you from debugging the first problem.



    First let's make a general improvement. You have



    try:
    [...]
    except OSError e:
    pass


    This means if the try part fails with OSError, it will just ignore it, tell you nothing about it, and carry on. At very least, log the error:



    try:
    [...]
    except OSError e:
    print(e)


    Now when it goes wrong you should be able to find out why from the system logs (/var/log/syslog I think).



    Now the real problem. I don't know what this gop thing is, and your extract doesn't show it, but you say it generates a file, which you indicate is in Images/Imagem.png -- although I suspect it's really in Documents/Images/Imagem.png. This is a relative path - relative to your current directory. When you load the file in the next line, you use an absolute path - relative to the filesystem root.



    When you run the file as user pi you are probably doing so from /home/pi (or ~pi, which is equivalent), your file goes into /home/pi/Documents/Images/Imagem.png, the absolute and relative paths happen to match up, and the next line can find the file. However when you run it from crontab, it will have a different current directory. I don't know offhand what current directory crontab will give it, but there's no way it'll be /home/pi.



    Either change gop (whatever that is) to put the file in an absolute location (I don't have the code to help with that), or change your code to read it from the same relative location:



    bot.sendPhoto(chat_id,open('Documents/Images/Imagem.png','rb'))


    Lastly, unless there is a good reason to run the script as root, don't. It should have the least privilege it requires to work. Just good practice.






    share|improve this answer



























      4














      You have two problems: the problem of the file not being found, and the problem preventing you from debugging the first problem.



      First let's make a general improvement. You have



      try:
      [...]
      except OSError e:
      pass


      This means if the try part fails with OSError, it will just ignore it, tell you nothing about it, and carry on. At very least, log the error:



      try:
      [...]
      except OSError e:
      print(e)


      Now when it goes wrong you should be able to find out why from the system logs (/var/log/syslog I think).



      Now the real problem. I don't know what this gop thing is, and your extract doesn't show it, but you say it generates a file, which you indicate is in Images/Imagem.png -- although I suspect it's really in Documents/Images/Imagem.png. This is a relative path - relative to your current directory. When you load the file in the next line, you use an absolute path - relative to the filesystem root.



      When you run the file as user pi you are probably doing so from /home/pi (or ~pi, which is equivalent), your file goes into /home/pi/Documents/Images/Imagem.png, the absolute and relative paths happen to match up, and the next line can find the file. However when you run it from crontab, it will have a different current directory. I don't know offhand what current directory crontab will give it, but there's no way it'll be /home/pi.



      Either change gop (whatever that is) to put the file in an absolute location (I don't have the code to help with that), or change your code to read it from the same relative location:



      bot.sendPhoto(chat_id,open('Documents/Images/Imagem.png','rb'))


      Lastly, unless there is a good reason to run the script as root, don't. It should have the least privilege it requires to work. Just good practice.






      share|improve this answer

























        4












        4








        4







        You have two problems: the problem of the file not being found, and the problem preventing you from debugging the first problem.



        First let's make a general improvement. You have



        try:
        [...]
        except OSError e:
        pass


        This means if the try part fails with OSError, it will just ignore it, tell you nothing about it, and carry on. At very least, log the error:



        try:
        [...]
        except OSError e:
        print(e)


        Now when it goes wrong you should be able to find out why from the system logs (/var/log/syslog I think).



        Now the real problem. I don't know what this gop thing is, and your extract doesn't show it, but you say it generates a file, which you indicate is in Images/Imagem.png -- although I suspect it's really in Documents/Images/Imagem.png. This is a relative path - relative to your current directory. When you load the file in the next line, you use an absolute path - relative to the filesystem root.



        When you run the file as user pi you are probably doing so from /home/pi (or ~pi, which is equivalent), your file goes into /home/pi/Documents/Images/Imagem.png, the absolute and relative paths happen to match up, and the next line can find the file. However when you run it from crontab, it will have a different current directory. I don't know offhand what current directory crontab will give it, but there's no way it'll be /home/pi.



        Either change gop (whatever that is) to put the file in an absolute location (I don't have the code to help with that), or change your code to read it from the same relative location:



        bot.sendPhoto(chat_id,open('Documents/Images/Imagem.png','rb'))


        Lastly, unless there is a good reason to run the script as root, don't. It should have the least privilege it requires to work. Just good practice.






        share|improve this answer













        You have two problems: the problem of the file not being found, and the problem preventing you from debugging the first problem.



        First let's make a general improvement. You have



        try:
        [...]
        except OSError e:
        pass


        This means if the try part fails with OSError, it will just ignore it, tell you nothing about it, and carry on. At very least, log the error:



        try:
        [...]
        except OSError e:
        print(e)


        Now when it goes wrong you should be able to find out why from the system logs (/var/log/syslog I think).



        Now the real problem. I don't know what this gop thing is, and your extract doesn't show it, but you say it generates a file, which you indicate is in Images/Imagem.png -- although I suspect it's really in Documents/Images/Imagem.png. This is a relative path - relative to your current directory. When you load the file in the next line, you use an absolute path - relative to the filesystem root.



        When you run the file as user pi you are probably doing so from /home/pi (or ~pi, which is equivalent), your file goes into /home/pi/Documents/Images/Imagem.png, the absolute and relative paths happen to match up, and the next line can find the file. However when you run it from crontab, it will have a different current directory. I don't know offhand what current directory crontab will give it, but there's no way it'll be /home/pi.



        Either change gop (whatever that is) to put the file in an absolute location (I don't have the code to help with that), or change your code to read it from the same relative location:



        bot.sendPhoto(chat_id,open('Documents/Images/Imagem.png','rb'))


        Lastly, unless there is a good reason to run the script as root, don't. It should have the least privilege it requires to work. Just good practice.







        share|improve this answer












        share|improve this answer



        share|improve this answer










        answered Mar 25 at 9:30









        Mark SmithMark Smith

        1,05159




        1,05159























            3














            Try this:



            $ sudo chmod 777 /home/pi/Documents/Images 


            After you've done that, re-boot to check if that fixes it.

            If not, try changing your crontab entry to this:



            @reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1)


            You should also consider adding a debug statement to your Python code to collect and save any errors that are thrown during execution.






            share|improve this answer

























            • I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:27












            • @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

              – Seamus
              Mar 24 at 18:22











            • @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

              – SWoto
              Mar 24 at 22:35












            • @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

              – Seamus
              Apr 6 at 0:20















            3














            Try this:



            $ sudo chmod 777 /home/pi/Documents/Images 


            After you've done that, re-boot to check if that fixes it.

            If not, try changing your crontab entry to this:



            @reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1)


            You should also consider adding a debug statement to your Python code to collect and save any errors that are thrown during execution.






            share|improve this answer

























            • I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:27












            • @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

              – Seamus
              Mar 24 at 18:22











            • @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

              – SWoto
              Mar 24 at 22:35












            • @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

              – Seamus
              Apr 6 at 0:20













            3












            3








            3







            Try this:



            $ sudo chmod 777 /home/pi/Documents/Images 


            After you've done that, re-boot to check if that fixes it.

            If not, try changing your crontab entry to this:



            @reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1)


            You should also consider adding a debug statement to your Python code to collect and save any errors that are thrown during execution.






            share|improve this answer















            Try this:



            $ sudo chmod 777 /home/pi/Documents/Images 


            After you've done that, re-boot to check if that fixes it.

            If not, try changing your crontab entry to this:



            @reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1)


            You should also consider adding a debug statement to your Python code to collect and save any errors that are thrown during execution.







            share|improve this answer














            share|improve this answer



            share|improve this answer








            edited Mar 24 at 18:05

























            answered Mar 24 at 16:15









            SeamusSeamus

            3,0571322




            3,0571322












            • I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:27












            • @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

              – Seamus
              Mar 24 at 18:22











            • @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

              – SWoto
              Mar 24 at 22:35












            • @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

              – Seamus
              Apr 6 at 0:20

















            • I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:27












            • @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

              – Seamus
              Mar 24 at 18:22











            • @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

              – SWoto
              Mar 24 at 22:35












            • @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

              – Seamus
              Apr 6 at 0:20
















            I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

            – SWoto
            Mar 24 at 17:27






            I thied this with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

            – SWoto
            Mar 24 at 17:27














            @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

            – Seamus
            Mar 24 at 18:22





            @SWoto: I'll edit my answer; check back shortly. In the meantime, what is the purpose of the stuff on your crontab: [Ctrl+X -> Y -> Enter] ?

            – Seamus
            Mar 24 at 18:22













            @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

            – SWoto
            Mar 24 at 22:35






            @Seamnu: i tried what u said and it didn't solve the problem. But i've some more info (i'll add it in the post too). The problem happens inside this funciton: gop.plotSetup(tbl[['Data',ts]]), right here f= plt.figure(figsize=(12, 9)). This is the first time using the variable 'f' and plt comes from import matplotlib.pyplot as plt. So the problem lies in the plt, not in the folter permission, because the saving step is the last thing inside the plotSetup function.

            – SWoto
            Mar 24 at 22:35














            @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

            – Seamus
            Apr 6 at 0:20





            @SWoto: Hopefully the answer from Mark Smith has resolved your issue. Do let us know if you're still stuck. If you did get an answer here that resolved your issue, please consider designating it as the "correct answer" by ticking the check box next to that answer.

            – Seamus
            Apr 6 at 0:20











            2














            This might be a permission problem. When running under the user's (your) credentials it works and when under the crontab's credentials is does not.



            Try a test: WRT to your images, temporarily open permissions to all images files and the associated directory and see if the application works when run by the crontab.



            Don't leave the permissions opened to all as it is a security risk.






            share|improve this answer























            • I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:30











            • There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

              – st2000
              Mar 24 at 21:20











            • just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

              – SWoto
              Mar 24 at 22:45















            2














            This might be a permission problem. When running under the user's (your) credentials it works and when under the crontab's credentials is does not.



            Try a test: WRT to your images, temporarily open permissions to all images files and the associated directory and see if the application works when run by the crontab.



            Don't leave the permissions opened to all as it is a security risk.






            share|improve this answer























            • I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:30











            • There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

              – st2000
              Mar 24 at 21:20











            • just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

              – SWoto
              Mar 24 at 22:45













            2












            2








            2







            This might be a permission problem. When running under the user's (your) credentials it works and when under the crontab's credentials is does not.



            Try a test: WRT to your images, temporarily open permissions to all images files and the associated directory and see if the application works when run by the crontab.



            Don't leave the permissions opened to all as it is a security risk.






            share|improve this answer













            This might be a permission problem. When running under the user's (your) credentials it works and when under the crontab's credentials is does not.



            Try a test: WRT to your images, temporarily open permissions to all images files and the associated directory and see if the application works when run by the crontab.



            Don't leave the permissions opened to all as it is a security risk.







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 24 at 14:21









            st2000st2000

            37414




            37414












            • I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:30











            • There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

              – st2000
              Mar 24 at 21:20











            • just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

              – SWoto
              Mar 24 at 22:45

















            • I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

              – SWoto
              Mar 24 at 17:30











            • There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

              – st2000
              Mar 24 at 21:20











            • just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

              – SWoto
              Mar 24 at 22:45
















            I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

            – SWoto
            Mar 24 at 17:30





            I thied this ($ sudo chmod 777 /home/pi/Documents/Images ) with no success. =/. Also changed the crontab code to: @reboot python3 /home/pi/Documents/telegrambot.py & /home/pi/Desktop/log.txt >&1 to get some error log, but nothing happened.

            – SWoto
            Mar 24 at 17:30













            There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

            – st2000
            Mar 24 at 21:20





            There may also be an issue with the path you use and the path which is used when running a crontab job. But since you indicated the python script was running I didn't mention it. Also, use complete paths to files avoiding problems associated with variables like "$HOME" or paths which start with "~".

            – st2000
            Mar 24 at 21:20













            just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

            – SWoto
            Mar 24 at 22:45





            just eddited the post. I found that the problem lies here: f= plt.figure(figsize=(12, 9)), inside the plotSetup function. I tried the complete paths too, like u and Seamus said: reboot ( /bin/sleep 30; /usr/bin/sudo /usr/bin/python3 /home/pi/Documents/telegrambot.py >> /home/pi/Desktop/log.txt 2>&1), but the problem persists.

            – SWoto
            Mar 24 at 22:45











            2














            like i said in the last edition that i made in the question...



            After adding the print sentence to some file after the exception, i got this:



            <class '_tkinter.TclError'>
            no display name and no $DISPLAY environment variable
            <traceback object at 0x6e3c8d50>


            Thit error led me to this post:



            _tkinter.TclError: no display name and no $DISPLAY environment variable



            that suggested to use this in the very beginning of the code:



            import matplotlib
            matplotlib.use('Agg')


            and then VOILA!! It's alive.



            Really appreciate all the help that you guys gave me, thanks @Seamus, @Mark Smith and @st2000!! ;p






            share|improve this answer























            • It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

              – Dmitry Grigoryev
              Mar 26 at 8:40















            2














            like i said in the last edition that i made in the question...



            After adding the print sentence to some file after the exception, i got this:



            <class '_tkinter.TclError'>
            no display name and no $DISPLAY environment variable
            <traceback object at 0x6e3c8d50>


            Thit error led me to this post:



            _tkinter.TclError: no display name and no $DISPLAY environment variable



            that suggested to use this in the very beginning of the code:



            import matplotlib
            matplotlib.use('Agg')


            and then VOILA!! It's alive.



            Really appreciate all the help that you guys gave me, thanks @Seamus, @Mark Smith and @st2000!! ;p






            share|improve this answer























            • It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

              – Dmitry Grigoryev
              Mar 26 at 8:40













            2












            2








            2







            like i said in the last edition that i made in the question...



            After adding the print sentence to some file after the exception, i got this:



            <class '_tkinter.TclError'>
            no display name and no $DISPLAY environment variable
            <traceback object at 0x6e3c8d50>


            Thit error led me to this post:



            _tkinter.TclError: no display name and no $DISPLAY environment variable



            that suggested to use this in the very beginning of the code:



            import matplotlib
            matplotlib.use('Agg')


            and then VOILA!! It's alive.



            Really appreciate all the help that you guys gave me, thanks @Seamus, @Mark Smith and @st2000!! ;p






            share|improve this answer













            like i said in the last edition that i made in the question...



            After adding the print sentence to some file after the exception, i got this:



            <class '_tkinter.TclError'>
            no display name and no $DISPLAY environment variable
            <traceback object at 0x6e3c8d50>


            Thit error led me to this post:



            _tkinter.TclError: no display name and no $DISPLAY environment variable



            that suggested to use this in the very beginning of the code:



            import matplotlib
            matplotlib.use('Agg')


            and then VOILA!! It's alive.



            Really appreciate all the help that you guys gave me, thanks @Seamus, @Mark Smith and @st2000!! ;p







            share|improve this answer












            share|improve this answer



            share|improve this answer










            answered Mar 25 at 22:58









            SWotoSWoto

            443




            443












            • It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

              – Dmitry Grigoryev
              Mar 26 at 8:40

















            • It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

              – Dmitry Grigoryev
              Mar 26 at 8:40
















            It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

            – Dmitry Grigoryev
            Mar 26 at 8:40





            It looks like you created two accounts by mistake. Please ask support to merge them, then you'll be able to edit your own question again.

            – Dmitry Grigoryev
            Mar 26 at 8:40

















            draft saved

            draft discarded
















































            Thanks for contributing an answer to Raspberry Pi Stack Exchange!


            • Please be sure to answer the question. Provide details and share your research!

            But avoid


            • Asking for help, clarification, or responding to other answers.

            • Making statements based on opinion; back them up with references or personal experience.

            To learn more, see our tips on writing great answers.




            draft saved


            draft discarded














            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fraspberrypi.stackexchange.com%2fquestions%2f95726%2fpython-script-not-running-correctly-when-launched-with-crontab%23new-answer', 'question_page');

            );

            Post as a guest















            Required, but never shown





















































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown

































            Required, but never shown














            Required, but never shown












            Required, but never shown







            Required, but never shown







            Popular posts from this blog

            How should I support this large drywall patch? Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern) Announcing the arrival of Valued Associate #679: Cesar Manara Unicorn Meta Zoo #1: Why another podcast?How do I cover large gaps in drywall?How do I keep drywall around a patch from crumbling?Can I glue a second layer of drywall?How to patch long strip on drywall?Large drywall patch: how to avoid bulging seams?Drywall Mesh Patch vs. Bulge? To remove or not to remove?How to fix this drywall job?Prep drywall before backsplashWhat's the best way to fix this horrible drywall patch job?Drywall patching using 3M Patch Plus Primer

            random experiment with two different functions on unit interval Announcing the arrival of Valued Associate #679: Cesar Manara Planned maintenance scheduled April 23, 2019 at 00:00UTC (8:00pm US/Eastern)Random variable and probability space notionsRandom Walk with EdgesFinding functions where the increase over a random interval is Poisson distributedNumber of days until dayCan an observed event in fact be of zero probability?Unit random processmodels of coins and uniform distributionHow to get the number of successes given $n$ trials , probability $P$ and a random variable $X$Absorbing Markov chain in a computer. Is “almost every” turned into always convergence in computer executions?Stopped random walk is not uniformly integrable

            Lowndes Grove History Architecture References Navigation menu32°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661132°48′6″N 79°57′58″W / 32.80167°N 79.96611°W / 32.80167; -79.9661178002500"National Register Information System"Historic houses of South Carolina"Lowndes Grove""+32° 48' 6.00", −79° 57' 58.00""Lowndes Grove, Charleston County (260 St. Margaret St., Charleston)""Lowndes Grove"The Charleston ExpositionIt Happened in South Carolina"Lowndes Grove (House), Saint Margaret Street & Sixth Avenue, Charleston, Charleston County, SC(Photographs)"Plantations of the Carolina Low Countrye