1

Ive got a python script that runs fine when I go to the file and hit run. However the script fails when the scheduler runs it. What could be causing this?

This is my script:

import timeimport osimport shutilimport statfor i in os.listdir():    if os.path.isdir(i):         shutil.rmtree(i)

This is the error I get when it is ran by scheduler

Traceback (most recent call last):  File "filepath/myscript.py", line 7, in <module>    for i in os.listidir():TypeError: listdir() takes exactly 1 argument (0 given)2017-01-25 17:10:12 -- Completed task, took 0.00 seconds, return code was 1.

Im confused why this works when I manually run it but not when the schedule runs it.

askedJan 25, 2017 at 17:25
Tyler Bell's user avatar
1

1 Answer1

1

You're running it under 2 different Python versions. Python 2 requires a path but Python 3, it's optional and defaults to '.'.

answeredJan 26, 2017 at 17:11
Glenn's user avatar
Sign up to request clarification or add additional context in comments.

Comments

Your Answer

Sign up orlog in

Sign up using Google
Sign up using Email and Password

Post as a guest

Required, but never shown

By clicking “Post Your Answer”, you agree to ourterms of service and acknowledge you have read ourprivacy 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.