Fixing imports. Adding requirements.txt

This commit is contained in:
ClaytonWWilson 2018-07-17 08:40:42 -04:00
parent 954c90b63c
commit 80a863c8f9
5 changed files with 28 additions and 8 deletions

View File

@ -187,6 +187,25 @@ def download(imageType, parsed_respObj):
quit()
return saveNameList
def installReqs():
if is_pip_installed == True:
# open Requirements.txt
# subprocess.call(["pip", "install", module], stdout=subprocess.DEVNULL,
# stdin =subprocess.DEVNULL,
# stderr=subprocess.DEVNULL)
else:
print("You need to install pip.")
def is_pip_installed():
try:
subprocess.call(["pip", "--version"], stdout=subprocess.DEVNULL,
stdin =subprocess.DEVNULL,
stderr=subprocess.DEVNULL)
except FileNotFoundError:
return False
else:
return True
# The following code is from Red-DiscordBot
# https://github.com/Cog-Creators/Red-DiscordBot
def is_git_installed():

View File

@ -1,4 +1,5 @@
import json
import requests
import datetime

View File

@ -4,15 +4,13 @@ from login import login
from actions import wait
from actions import clear_screen
from actions import clearFolders
from actions import installReqs
from actions import refreshToken
from actions import update
from search import search
# TODO fix naming convention for all variables and functions
def user_choice():
return input("> ").lower().strip()
while True:
clear_screen()
print("=============================\n"
@ -22,12 +20,11 @@ while True:
print("1. Search theTVDB.com")
print("2. Clear download folders")
print("3. Login/Change login")
# print("4. Refresh API Token")
print("4. Install Requirements")
print("5. Check for updates\n")
print("0. Exit\n")
choice = user_choice()
choice = input("> ").lower().strip()
if choice == "1":
search()
@ -36,12 +33,12 @@ while True:
clear_screen()
clearFolders()
wait()
elif choice == "3": # TODO if already logged in, ask 'are you sure?'
elif choice == "3": # TODO add a printout that tells the user who is currently logged in
clear_screen()
login()
wait()
elif choice == "4":
print("install requirements not implemented yet")
installReqs()
wait()
elif choice == "5":
update()

3
requirements.txt Normal file
View File

@ -0,0 +1,3 @@
python-dateutil==2.6.1
requests==2.18.4
urllib3==1.22

View File

@ -2,9 +2,9 @@ import os.path
import json
import datetime
import dateutil
import requests
import urllib.parse
import dateutil
from actions import clearFolders
from actions import clear_screen