Skip to content

Commit

Permalink
Python3 Compatability
Browse files Browse the repository at this point in the history
  • Loading branch information
leokhachatorians committed Jan 27, 2016
1 parent 7ff6282 commit b9c8c33
Showing 1 changed file with 10 additions and 5 deletions.
15 changes: 10 additions & 5 deletions DSDownload/DSDownload.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,8 +5,13 @@
MIT License
DSDownload - DSDownload is a fully featured download library with focus on performance
"""
import sys

if sys.version_info[0] == 2:
import Queue
else:
import queue as Queue

import Queue
import downloadthread
import sys
import argparse
Expand All @@ -18,7 +23,7 @@ def DSDownload(urlList, workers = 5, folderPath = 'downloads'):
for url in urlList:
queue.put(url)

for i in range(workers):
for worker in range(workers):
t = downloadthread.downloadthread(queue, folderPath)
t.start()

Expand All @@ -41,11 +46,11 @@ def main(argv=sys.argv[0]):

try:
DSDownload(args.urls, args.workers, args.output)
print 'All files were downloaded.'
print('All files were downloaded.')
except KeyboardInterrupt:
print 'Interrupt received, stopping downloads'
print('Interrupt received, stopping downloads')

sys.exit()

if __name__ == "__main__":
main(sys.argv[1:])
main(sys.argv[1:])

0 comments on commit b9c8c33

Please sign in to comment.