mirror of
https://github.com/KevinMidboe/bulk-downloader-for-reddit.git
synced 2025-10-29 17:40:15 +00:00
Changed quit() to sys.exit()
This commit is contained in:
30
script.py
30
script.py
@@ -199,7 +199,7 @@ class PromptUser:
|
|||||||
programModeIndex = input("> ")
|
programModeIndex = input("> ")
|
||||||
|
|
||||||
if choice == "0":
|
if choice == "0":
|
||||||
quit()
|
sys.exit()
|
||||||
elif choice in choicesByIndex:
|
elif choice in choicesByIndex:
|
||||||
return choices[int(choice)-1]
|
return choices[int(choice)-1]
|
||||||
else:
|
else:
|
||||||
@@ -389,7 +389,7 @@ def postFromLog(fileName):
|
|||||||
content = jsonFile(fileName).read()
|
content = jsonFile(fileName).read()
|
||||||
else:
|
else:
|
||||||
print("File not found")
|
print("File not found")
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
del content["HEADER"]
|
del content["HEADER"]
|
||||||
@@ -497,7 +497,7 @@ def download(submissions):
|
|||||||
"Imgur login failed. Quitting the program "\
|
"Imgur login failed. Quitting the program "\
|
||||||
"as unexpected errors might occur."
|
"as unexpected errors might occur."
|
||||||
)
|
)
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
print(exception)
|
print(exception)
|
||||||
@@ -596,7 +596,7 @@ def main():
|
|||||||
PromptUser()
|
PromptUser()
|
||||||
except Exception as err:
|
except Exception as err:
|
||||||
print(err)
|
print(err)
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
GLOBAL.config = getConfig("config.json")
|
GLOBAL.config = getConfig("config.json")
|
||||||
|
|
||||||
@@ -604,38 +604,38 @@ def main():
|
|||||||
if GLOBAL.arguments.log is not None:
|
if GLOBAL.arguments.log is not None:
|
||||||
logDir = Path(GLOBAL.arguments.log)
|
logDir = Path(GLOBAL.arguments.log)
|
||||||
download(postFromLog(logDir))
|
download(postFromLog(logDir))
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
try:
|
try:
|
||||||
POSTS = getPosts(prepareAttributes())
|
POSTS = getPosts(prepareAttributes())
|
||||||
except InsufficientPermission:
|
except InsufficientPermission:
|
||||||
print("You do not have permission to do that")
|
print("You do not have permission to do that")
|
||||||
quit()
|
sys.exit()
|
||||||
except NoMatchingSubmissionFound:
|
except NoMatchingSubmissionFound:
|
||||||
print("No matching submission was found")
|
print("No matching submission was found")
|
||||||
quit()
|
sys.exit()
|
||||||
except NoRedditSupoort:
|
except NoRedditSupoort:
|
||||||
print("Reddit does not support that")
|
print("Reddit does not support that")
|
||||||
quit()
|
sys.exit()
|
||||||
except NoPrawSupport:
|
except NoPrawSupport:
|
||||||
print("PRAW does not support that")
|
print("PRAW does not support that")
|
||||||
quit()
|
sys.exit()
|
||||||
except MultiredditNotFound:
|
except MultiredditNotFound:
|
||||||
print("Multireddit not found")
|
print("Multireddit not found")
|
||||||
quit()
|
sys.exit()
|
||||||
except InvalidSortingType:
|
except InvalidSortingType:
|
||||||
print("Invalid sorting type has given")
|
print("Invalid sorting type has given")
|
||||||
quit()
|
sys.exit()
|
||||||
except InvalidRedditLink:
|
except InvalidRedditLink:
|
||||||
print("Invalid reddit link")
|
print("Invalid reddit link")
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
if POSTS is None:
|
if POSTS is None:
|
||||||
print("I could not find any posts in that URL")
|
print("I could not find any posts in that URL")
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
if GLOBAL.arguments.NoDownload:
|
if GLOBAL.arguments.NoDownload:
|
||||||
quit()
|
sys.exit()
|
||||||
|
|
||||||
else:
|
else:
|
||||||
download(POSTS)
|
download(POSTS)
|
||||||
@@ -654,7 +654,7 @@ if __name__ == "__main__":
|
|||||||
if GLOBAL.directory is None:
|
if GLOBAL.directory is None:
|
||||||
GLOBAL.directory = Path(".\\")
|
GLOBAL.directory = Path(".\\")
|
||||||
print("\nQUITTING...")
|
print("\nQUITTING...")
|
||||||
quit()
|
sys.exit()
|
||||||
except Exception as exception:
|
except Exception as exception:
|
||||||
logging.error("Runtime error!", exc_info=full_exc_info(sys.exc_info()))
|
logging.error("Runtime error!", exc_info=full_exc_info(sys.exc_info()))
|
||||||
print(log_stream.getvalue())
|
print(log_stream.getvalue())
|
||||||
|
|||||||
Reference in New Issue
Block a user