-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathmain.py
45 lines (33 loc) · 1018 Bytes
/
main.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
import csv
import os
import sys
import time
from platform import system, python_version, platform
def check_python_version():
x = python_version()
if not x.__contains__('2.'):
sys.stderr.write('Please consider using a python version 2 for this project')
else:
sys.stdout.write("Pass, The system is using python 2")
time.sleep(2)
check_system()
def check_system():
x = system()
if x is not 'Windows':
sys.stderr.write('Please use a Windows based machine')
sys.exit(0)
else:
sys.stderr.write('Pass, system is running on Windows')
time.sleep(2)
get_details()
def get_details():
import subprocess as sp
os.system('echo list volume > command.txt')
path = os.path.join(os.getcwd(),"command.txt")
command = ("diskpart" + path)
with open('output.txt', 'a') as outfile:
sp.call(command, stdout=outfile)
def main():
return check_python_version()
if __name__ == '__main__':
main()