How does a program run on its on indefinitely [duplicate] - python

This question already has answers here:
Set up a scheduled job?
(26 answers)
Python script to do something at the same time every day [duplicate]
(4 answers)
what is a cron job [closed]
(3 answers)
Closed 2 years ago.
say I have a python program that uploads a photo on Instagram. If I wished to use that program every day,
is there another way of doing so, other then the following (trivial) options?:
run it on your own every day (for ex. with an IDE)
set a timer that performs the operation daily, and run the program with a while(true) loop
the Instagram example is simply for the purpose of the discussion

Related

timer in python code but like a montlyh subscription [duplicate]

This question already has answers here:
set a Python program to expire after a certain number of days
(1 answer)
Simple license protection for Python app
(1 answer)
Closed 10 months ago.
I'm a new coder.
That's why I have a program that I want to ask, but I need to create a timer and the program should not open when the timer is finished, how can I do this? Can you help me with this?
What should I try in this program and make a similar monthly subscription?
import time
time.sleep(5)
5 being the seconds waiting

Clear the Python shell window [duplicate]

This question already has answers here:
how to clear the screen in python [duplicate]
(1 answer)
How to clear the interpreter console?
(31 answers)
Closed 3 years ago.
I'm trying to clear the shell window when the actual code runs. I've done a couple different searches and saw some options but none seem to work. Here is the one I've been trying to get to work (I'm using Python 3.8.1).
import os
os.system('cls')

How do you stop a thread in python? [duplicate]

This question already has answers here:
Is there any way to kill a Thread?
(31 answers)
Closed 3 years ago.
I have a very simple thread in python:
threading.Thread(target=self.clock).start()
All I want to do is be able to delete the current one and make a new one (that will be set to 0 seconds), so it can start counting again, but no matter what I try I cannot stop the original thread from counting.
Unlike the processes that can be terminated, the thread will run until the function returns.

Selenium python - take screenshot on failure and save it into a folder [duplicate]

This question already has answers here:
How do I capture a screenshot if my nosetests fail?
(4 answers)
Closed 7 years ago.
I am trying to take a screenshot with selenium python on failure. I have written 30 tests and I want to add something in my tear down method in my base class method. How can I achieve this?
You could to a try block and call browser.get_screenshot_as_file() on failure.

Is there anyway to use python to take a snapshot [duplicate]

This question already has answers here:
Get screenshot on Windows with Python?
(9 answers)
Closed 9 years ago.
Im working on a program and i was wondering if i can use python to snapshot my screen and possibly save it on my computer ?
If you are using Windows, ImageGrab looks like it would work (http://effbot.org/imagingbook/imagegrab.htm).

Categories

Resources