Skip to content

Commit bd0e61a

Browse files
author
lucasgit13
committed
auto install requirements
1 parent b11bc97 commit bd0e61a

File tree

1 file changed

+14
-10
lines changed

1 file changed

+14
-10
lines changed

Get-Dir-Github-Repo/get.py

Lines changed: 14 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -16,20 +16,23 @@
1616
try:
1717
import requests
1818
except:
19+
print('Attempting to install the requirements...')
1920

2021
try:
2122
for module in modules:
22-
subprocess.run(['python', '-m', 'pip', 'install', module])
23+
subprocess.run(['python', '-m', 'pip', 'install', module],
24+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
2325
import requests
26+
print('Requirements was successful installed!')
2427
except:
25-
pass
26-
27-
try:
28-
for module in modules:
29-
subprocess.run(['python3', '-m', 'pip', 'install', module])
30-
import requests
31-
except:
32-
sys.exit('Could not install requirements')
28+
try:
29+
for module in modules:
30+
subprocess.run(['python3', '-m', 'pip', 'install', module],
31+
stdout=subprocess.DEVNULL, stderr=subprocess.DEVNULL)
32+
import requests
33+
print('Requirements was successful installed!')
34+
except:
35+
sys.exit('Could not install requirements :(')
3336

3437

3538
### Comandline arguments ###
@@ -98,7 +101,8 @@ def check_url(url):
98101
sys.exit("Someone closed the program")
99102
else:
100103
if r.status_code == 404:
101-
sys.exit("404: Verify internet connection or check if the url is correct")
104+
sys.exit(
105+
"404: Verify internet connection or check if the url is correct")
102106

103107
if not "https://github.com/" in url:
104108
sys.exit("Not a Github repo")

0 commit comments

Comments
 (0)