2017-01-25 7 views
1

필자가 파일을 실행하고 실행하면 python 스크립트가 실행됩니다. 그러나 스케줄러가 스크립트를 실행할 때 스크립트가 실패합니다. 무엇이 이것을 일으킬 수 있습니까? PythonAnywhere 스크립트 스케줄러가 작동하지 않습니다.

내 스크립트입니다

import time 
import os 
import shutil 
import stat 

for i in os.listdir(): 
    if os.path.isdir(i): 
     shutil.rmtree(i) 

이다가 스케줄러에 의해 실행 때 내가 오류

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. 

임 내가 수동으로 할 때 일정을 실행하지만 때이 작품 왜 혼란 그것을 실행합니다.

+0

https://docs.python.org/2/library/os.html#os.listdir – hashcode55

답변

1

두 가지 다른 Python 버전에서 실행 중입니다. 파이썬 2는 경로가 필요하지만 파이썬 3은 선택 사항이며 기본값은 '.'입니다.