При использовании функции input() у меня вылезает ошибка EOFError: EOF when reading a line.
Вот мой код:
def create_a_virtual_environment(*args, **kwargs):
base = 'python 01_score.py '
os.popen(f'{base}-cc', 'w')
while True:
working_code = input()
if working_code == 'exit' or working_code == '-ex':
os.popen(f'{base}-cc', 'w')
break
elif '-cc' in working_code or '--clear_console' in working_code:
os.popen(f'{base}{working_code}', 'w')
time.sleep(0.1)
print('You have cleared the screen and can continue using this program.')
time.sleep(1)
os.popen(f'{base}{working_code}', 'w')
elif '-cve' in working_code or '--create_a_virtual_environment' in working_code:
confirmation = input('Heh... cough-cough? You are already in a virtual environment, \nbut if you want' + \
' to do so, confirm this action Yes(Y) or No(N): ')
print(confirmation)
if confirmation == 'Y' or confirmation == 'Yes' or confirmation == 'y' or confirmation == 'yes':
os.popen(f'{base}{working_code}', 'w')
elif confirmation != 'N' or confirmation != 'No' or confirmation != 'n' or confirmation != 'no':
print('There is no such command')
continue
elif len(re.compile(' ').sub('', working_code)) == 0:
continue
elif working_code == 'help':
result = os.popen(f'{base}-h', 'r').read()
print(result)
elif '-Ive?' in working_code or '--I_in_a_virtual_environment?' in working_code:
print(True)
else:
result = os.popen(f'{base}{working_code}', 'r').read()
print(result)
time.sleep(0.1)
print('You have left the virtual environment. Press "Enter"')
time.sleep(1.0)
os.popen(f'{base}-cc', 'w')
time.sleep(0.1)
return ''
Значит, где-то не закрыли скобку или кавычку. Поищите. Если все в порядке, то вот совет: нельзя открыть файл на чтение, если не закрыли его на запись.