I've tried to find some help with online searches and wasn't able to find anything so I'm posting on here and hoping. I've got a bunch of code with 3 "for" loops and a try/except statement inside of the 3rd "for" loop. I run the module from IDLE and it runs fine for about 16 hours then just quits and prints on the IDLE command screen =====Restart====. It does this randomly so I can't replicate it but I've gone through by hand and was able to process the data that it quit on without a problem. Does anyone know of a way to have python email myself when this occurs? I've tried putting the main code inside of a definition and use a
try:
definition
except:
send email
but this doesn't work either. I've got the emailing part of the code working fine. I apologize that I am not including the code here. I've talked to my boss about it, but since it is dealing with sensitive data I'm not allowed to. Any guidance that you can provide would be greatly appreciated.
Thanks
Related
yesterday i wrote an application using for loop that worked exactly as I wanted it to work, but today when I opened it up without changing a thing it is not working. and this is happening every time I try to make something similar. i also tried inspecting the page but I only see an empty div while there is actually for loop inside it. any help would be appreciated. thanks
I also created new app and did exact same things. i just coppied code and it worked. but when i try to do same in this application it remains the same.
The task I need to do is to write some python codes to make computer can execute another python code which is provided by my colleague at 8 am every day. (The codes he provide me could be used to automatically download something from the internet or processing some excel sheets)
Actually, I have already found a previous post in StackOverflow which could very match what I want:
Python script to do something at the same time every day
However, I am a python beginner, so I don't know what is the "exact / practical" way to execute these codes. My questions could stupid but hope someone still can help me.
Let me describe my problems below...
Scenario Background:
Each day, My colleague will push ctrl+L to lock his computer (not log off or shut down) before leaving the office and the computer will go into sleep mode in the final.
He will come to the office at around 9 am, but he hopes my python code can automatically execute some of his python codes at 8 am each day.
The final result should be like this:
Automatically wake up the computer (I think this step can be done by windows setting, instead of using python. Would it be easier?)
Even the computer is still locked, my python code should still automatically execute another python code at 8 am.
So my codes are as follow (Based on that previous post in StackOverflow):
from datetime import datetime
from threading import Timer
x=datetime.today()
y=x.replace(day=x.day+1, hour=8, minute=0, second=0)
delta_t=y-x
secs=delta_t.seconds+1
def daily_task():
# Put my Colleague's codes here
t = Timer(secs, daily_task)
t.start()
My real question is:
I write these codes in Spyder (This is the only environment I know how to use...) Should I just press F5 and execute all my codes and then it's done?
Or should I run these codes on cmd or something like that?
Will my codes still work after I close down my Spyder?
If my code will still work after I close Spyder, then what is the exact way to stop my code?
Sorry, I know my question could be very stupid or even ask the wrong questions.
But I usually only use python to do some very simple data processing and analysis, and never use it to do such a practical thing. So I totally have no idea how to do it even though I have already googled it.
I Apologise for being a noob - both to asking questions, and python.
I've writen a program, which will be running full time. I have that working ok. It uses the try function to look for an input from a touchscreen.
I now wish to try for 30s,and if there is no input, jump to a blackscreen routine (screensaver), from which it will be looking for any touch to go back to the original try
I think i need an except routine, but i'm tying myself up in knots working out with where to put everything.
Any guidance appreciated
edit
this is Python for use on a raspberry PI.
all i have in code now, is the basic try as follows.
while(True):
try:
get_call()
except SystemExit:
the get_call() routine, sets up some pygame screens, then looks to an on_click() routine for touchscreen input.
I wish to try to get_call() for 30s, and if nothing happens from that, go to screensave()
I know its not much to go on, my code is that of a self taught noob, with no knowledge of best practices, or decent formatting. If anyone wants to look through what i've done, i'll happily zip it all up, and send it through.
Alright, so I got a question and hopefully you guys will be able to help me out with this.
Basically what I'm trying to do is this:
Read what users write in Skype (using the Skype4Py lib).
Convert specific lines from users into a keyboard event.
Pass keyboard events to another (non-python-related) process (.exe) running locally.
Now the first two bullets are definitely doable but I'm not really sure how one would go about the last one. I'm assuming it's possible but I have absolutely no clue which module(s) I would need. If anyone has suggestions, modules or even examples for the last bullet I would very much appreciate it.
Some days ago I started a project where I need to create a web scraper. An user suggested me to try Windmill.
Everything is fine but I have a problem: when I call to getPageText() function it sometimes hungs and never ends. I have tried some possible solutions but without success. Besides, I haven't found any information about this problem so I don't know how to proceed.
Any idea?
Try one of these:
client.waits.sleep(milliseconds=12000)
client.waits.forPageLoad(timeout='60000')