i just started working with python and with some scripts to automate some tasks. I manage to create a web scraper using selenium that notifies me daily with the latest news via a mail . Now the script works great if i run it manually , but my question is : How can i make the script to run automatically every day , and what option would you recomand . I know that you can use TaskScheduler and program it , but i was wondering if you know any options to run it directly in the cloud ? Also , i found some tutorials where they say to wrap all the code in an infinite loop and add a timer , and once you run the script it will stay active as a background process,
I just started working with scripts and automation , so i would really like to know your opinion on the best way to run the script automatically . Thanks a lot
If this is on a unix-based OS, check out cron (this is a pretty good guide). You can schedule it to run your python script daily.
Im not sure if that is what you are looking for, but (if you are on windows) you could attach your program to your autostart. Probably your Startup Folder: C:\ProgramData\Microsoft\Windows\Start Menu\Programs\Startup
If you schedule in your computer, i think it may not be proper solution. It's better to deploy it on any cloud platforms & schedule at any particular time.
I personally suggest Heroku, I'm using it for running multiple scripts for free. You can use scheduler addon for scheduling scripts to run at particular time as well. Please refer to heroku documentation & get started! Note: The script may run more time than you expected, please refer here to fix this.
Related
I have created several scripts in PyCharm, inside an Anaconda3 environment. The thing is that I would like to run them with the task scheduler during the night, so hopefully by the time I get up they have done their stuff.
I have read a million post in Microsoft support and in here, and I haven't found an answer for this issue.
This is a print of the set-up for the Task Scheduler:
For the program, I use the path to python.exe inside anaconda ( I take this path from cmd / where python).
Start in: the route to the script: C:\Users\oper\PycharmProjects\MyProject
It doesn't run, and it brings the error: 0x1. Opens a CommandPrompt windows and immediately closes it. I see the error in: Last Run Result.
I have been able to run a much simpler code that prints a .txt in a specified folder - but not this one.
Additional info:
this script runs a Selenium WebDriver and navigates some websites, connects with Google's OCR, etc. All these steps are written in several other modules for ease of coding.
All the libraries used were installed using pip inside PyCharm's terminal. Might be related to not having the libraries in sync? Don't know how to check that.
I would also like to set up a wake-up from sleep for the computer. Probably a different problem for another question.
Thanks in advance.
I have a workbook that contains a macro that I would like to run once a week automatically.
I have set up the workbook_open event to run the macro and the code itself runs as I would like it to.
My question is how to schedule this to automatically run on a schedule. I have setup a task in windows task scheduler which does not seem to run reliably (i've tried this on a few different projects over the years and never get great results).
My desire is to have my personal desktop run this task whether or not I am logged in. (Obviously the computer needs to be powered on which is no problem. Also, I am the only one that uses this computer, no concern about someone else being logged in)
Is there a more robust way of doing this or am I stuck with task scheduler? If so, has anyone else had better success with it that might be able to help me out?
Task scheduler seems to work only intermittently although the "history" shows it is triggered and run at the desired times. Part of the code saves a file to a location with a date stamp and there are not files for each trigger in the scheduler history.
When logged off , the task is executed without loading the user profile.
Maybe this is the answer for you.
It's Japanese. Can you use google translate?
enter link description here
You have to make the directory.
If you use 32bit Excel : %SystemRoot%\System32\config\systemprofile\Desktop
If you use 64bit Excel : %SystemRoot%\SysWOW64\config\systemprofile\Desktop
For anyone that might run across this. I've been using a 3rd party task scheduler which is much more reliable in my experience. There are many out there but i use robointern. robointern website
I am struggling to create scheduled task that will execute power shell script.
I found only the documentation that not help if you do this for the first time.
Can anyone point me to the right place.
Thanks.
I do not really understand what exactly is your problem.But i developed a scheduled task for install shield before a month, using the Automation Interface that Flexera provides.
Install Shield 2012 Automation Interface
In the page above you will find how to open a current project or create a new one and after you manage all the project properties with the provided API through your program.
I found it easier to create a project from the GUI so i can use it as a Template after and just modify it from my program to fit my needs for every new project that i wanted to release.It was easier like this because i had only to modify the version and put new sources inside.
I hope i provided you with some new information,otherwise let me now if i misunderstood you and tell me what exactly is your problem so i can assist you better :)
Best Regards
I'am currently writing an application that has to search on a web site if an update exists for this application. If it is the case the application download a setup file (created with inosetup) and then execute it.
My application is written in C++. And I do not arrive to do this process. I'am trying to call the setup using system(). If the command is system("mysetup") I cannot obtain what I want because the setup cannot replace the exe (currently running). So, I have tried to use system("cmd /C mysetup"), system("cmd/C start /min mysetup"), system ("cmd /C start /min /separate mysetup") without success. In these cases, the fact to stop the application also stop the setup. So I suppose that the setup is considered as a child process.
I have seen in some posts that it might be possible to use execcl(). But this function is in unistd.h. And this library is a little bit to specific for my needs (I need to be able to run on virtualized windows).
So do you have a way to do what I want?
Thanks for your help
OK,
A colleague to me gave me the solution. As we are using QT a QProcess::startDetached does exactly what I want.
I want to automate the process of running coded UI tests.
Do i need to have user logged in to the system?
Or is it possible to run it using XYNT service?
We are able to run our coded ui tests in an automated fashion using windows scheduler and the command line MSTest.exe. Take a look at the following MSDN article on how to accomplish this:
http://msdn.microsoft.com/en-us/library/ms182486.aspx
I believe you can use Microsoft's Test Manager to accomplish this as well but we don't have TFS (yet) so I can't vouch for it.
As far as I know, CodedUI Tests require an active desktop session, so running them under a service account without an open desktop session may work, but not without a session.
I used the mstest to run the coded ui test and use Windows TaskScheduler to schedule the test.
You can find detail in MSTest.exe command-line documentation.
When you want to run it automatically, there are two things you should pay attention:
1. Set auto log on
2. Close the screen saver
You need to take the snapshot of your enviroment with user logged in and then you can run your test through MS Test Manager or TFS (nightly build process)
Write the test's in Visual Studio 2010/2012, this means you can manually edit the test's the code, then you should run them in Test Manager,
BTW you need TFS and Test Manager to be the same year otherwise it won't work.
I've being doing a lot of these recently if you have any questions post it online and send me a message, I'll be happy to help.