Skip to content

Commit b5e547e

Browse files
committed
fix TMPDIR_PATH not exits at first run
1 parent 8c22aff commit b5e547e

File tree

2 files changed

+8
-7
lines changed

2 files changed

+8
-7
lines changed

.gitignore

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -116,6 +116,7 @@ crashlytics.properties
116116
crashlytics-build.properties
117117
fabric.properties
118118
*.txt
119+
!requirements.txt
119120
*.rdb
120121
.tmp
121122
.DS_Store

tspider.py

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -57,13 +57,13 @@ def cmdparse():
5757
if args.keepon:
5858
redis_handle.restore_startup_params(args)
5959
logger.info(args)
60-
61-
for f in os.listdir(TMPDIR_PATH):
62-
os.remove(os.path.join(TMPDIR_PATH, f))
63-
tspider_context = {}
64-
tspider_context['live_spider_counts'] = Value('i', 0)
65-
tspider_context['task_done'] = Event()
66-
tspider_context['lock'] = Lock()
60+
if os.path.exists(TMPDIR_PATH):
61+
for f in os.listdir(TMPDIR_PATH):
62+
os.remove(os.path.join(TMPDIR_PATH, f))
63+
tspider_context = {
64+
'live_spider_counts': Value('i', 0),
65+
'task_done': Event(),
66+
'lock': Lock()}
6767
kwargs = {'tld': args.tld, 'cookie_file': args.cookie_file,
6868
'redis_db': args.redis_db, 'mongo_db': args.mongo_db}
6969
for _ in range(args.consumer):

0 commit comments

Comments
 (0)