Advertisement
Guest User

Untitled

a guest
Jul 22nd, 2018
83
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
Python 2.76 KB | None | 0 0
  1. global conf
  2. with open('system_data.txt') as json_file:
  3.     for y in json.load(json_file):
  4.         conf = str(y['boot_config'])
  5.  
  6. def start():
  7.     global login, conf
  8.     with open(f'user.txt') as json_output:
  9.         data = json.load(json_output)
  10.         global t, login_en, passwd_en
  11.         for t in data:
  12.             login_en = t['login']
  13.             passwd_en = t['password']
  14.     global root, anim_speed
  15.     with open(f'config_{conf}.txt') as json_file:
  16.         data = json.load(json_file)
  17.         for p in data:
  18.             root = bool(p['root'])
  19.             anim_speed = float(p['anim_speed'])
  20.     if (login_en, passwd_en) == ('new', 'new'):
  21.         login = input ('Enter new login: ')
  22.         passwd = input ('Enter new password: ')
  23.         user_data = {}
  24.         user_data['user_data'] = []
  25.         user_data['user_data'].append({
  26.             'login': login,
  27.             'password': passwd
  28.         })
  29.         with open('user.txt', 'w') as out_json:
  30.             json.dump(user_data['user_data'], out_json)
  31.         os.system('cls')
  32.         print ('New account created!')
  33.         time.sleep(1)
  34.         welcome()
  35.     else:
  36.         login = input('Enter login: ')
  37.         if login == '_':
  38.             conf = input ('config_')
  39.             try:
  40.                 with open(f'config_{conf}.txt') as json_file:
  41.                     data = json.load(json_file)
  42.                     for p in data:
  43.                         root = bool(p['root'])
  44.                         anim_speed = float(p['anim_speed'])
  45.                         start()
  46.             except:
  47.                 print ('ConfigNotFoundError! Choose another config!')
  48.                 start()
  49.         password = input ('Enter password: ')
  50.         if (login, password) == (login_en, passwd_en):
  51.             welcome()
  52.         else:
  53.             print ('----------------------------------------\n'
  54.                    '| You entered wrong login or password! |\n'
  55.                    '----------------------------------------')
  56.             start()
  57.  
  58. .......
  59.  
  60. def main():
  61.     os.system('cls')
  62.     global root
  63.     global password
  64.     global login
  65.     global version
  66.     global conf
  67.     version = 'AMT OS v.3.2 alpha 2.3.2 build 23'
  68.     print(
  69.         f'-------------------------------------\n| {version} |\n--------------------------------------------------------'
  70.         f'----\n| Enter "commands" to see command list                     |\n| Enter "info" to get information about '
  71.         f'system             |\n------------------------------------------------------------')
  72.     inp_sym = f'{login}|> ' if root == False else f'root|{login}|> '
  73.     command = input (inp_sym).split()
  74.  
  75. '''
  76. и при этом выскакивает ошибка, что в inp_sym переменная root не найдена
  77. '''
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement