-
Notifications
You must be signed in to change notification settings - Fork 1
/
crear-clave.py
58 lines (45 loc) · 1.26 KB
/
crear-clave.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
46
47
48
49
50
51
52
53
54
55
56
57
58
from analisis import evaluar
from openpyxl import Workbook
from openpyxl import load_workbook
import os
must_repeat = True
#interfaz
while must_repeat:
print('introduzca nombre del archivo de claves, sin la extension jpg')
nombre = input()
try_name_1 = 'examenes/' + nombre + '.jpg'
try_name_2 = nombre + '.jpg'
if os.path.exists(try_name_1):
pre_name = 'examenes/'
elif os.path.exists(try_name_2):
pre_name = ''
else:
print('Ningun archivo encontrado llamado ', try_name_2)
continue
print('Archivo ', try_name_2, ' encontrado, ¿Continuar?')
resp = input()
if len(resp)>0:
resp = resp[0].lower()
else:
resp = 's'
if resp in 'sy':
print('Analizando clave')
must_repeat = False
else:
print('cancelado por usuario, probar nombre nuevo')
print()
if not os.path.isdir('examenes_coloreados'):
os.makedirs('examenes_coloreados')
nombre =pre_name + nombre + '.jpg'
clave = evaluar(nombre)
#Crear workbook nuevo
wb = Workbook()
#Seleccionar la worksheet activa
ws = wb.active
#Guardar los resultados
for line in clave:
ws.append(line)
wb.save('clave.xlsx')
del(ws)
del(wb)
print('\n\nAnálisis de clave completado.\n\n')