1

So I have the following script which I am using to grab data from the net and save it as an html file in a folder on my pc (same pc) each time I run the script. I'm now trying to automate the process.

import pandas as pd
import datetime as dt
today_date = dt.date.today().isoformat()
df = pd.read_html('http://www.livevol.com/largest-option-trades-on-the-day', header=1)[0].set_index('Time')
html_name = 'option data/{}.html'.format(today_date)
df.to_html(html_name)

Ordinarily, when I click on the .py, I get a the black screen (command prompt) which lasts for a few seconds and then If I go to a certain folder, I see that a new html has been created.

However, when I use Windows scheduler, the script seems to run but an html file is not being created.

The script seems to be running because the command prompt black screen pops up and stays there for a few seconds (rather than just flashing), just like it did when I manually clicked on the .py file.

I've played around with the different parameters of the "actions" field of Windows Scheduler.

Program/script: C:\Python27\python.exe Add arguments: C:\Python27\Option.py

"Run when user is logged on" and "highest privileges" are check-marked.

Not sure what I'm doing wrong. Thanks.

4
  • Admittedly, I'm no Windows guru, but are you sure the program has permission to write to that directory when run from the Windows Scheduler? Commented Sep 30, 2016 at 16:00
  • I'm running as the administrator so I think it should. I'm going to try reinstalling Python2.7 as I have been having this odd bug, where a different script runs in addition to the script I want to run. Essentially, one script has been somehow imprinted into Python so that whenever I run any script, the imprinted script first get ran, and then the script I chose will get ran. Weird bug, and maybe that's what Is confusing Windows Scheduler. Commented Sep 30, 2016 at 17:55
  • So I reinstalled Python2.7 but still can't get Windows Scheduler to run that file. I'm wondering if it is indeed some permission problem. I'm going to Google it see what I come up with. Commented Sep 30, 2016 at 18:27
  • Have a look at my answer in here: stackoverflow.com/questions/54847871/… Cheers Commented Jul 2, 2019 at 14:04

2 Answers 2

0

I got it working by filling in the "Start in(optional)" parameter under the Actions tab, with the first part of the path to the Python exe.

"C:\Python27"

Sign up to request clarification or add additional context in comments.

Comments

0

this worked for me:

set up a conda environment: Schedule a Python script via batch on windows (using Anaconda)

if you need a proxy: Running conda with proxy

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.