-2
Следующий код выполняется должным образом в IDLE, но возвращает ошибку в консоли.Мой скрипт python работает в IDLE, но не в консоли
import sys, math, string, time, os
from time import *
restart0 = True
while restart0:
def addDecimal():
print(".", end="\r")
breakout0 = False
invalidcommand0 = True
while invalidcommand0:
file = open("HighScores.txt","r+")
sleep(0.5)
print("\nWelcome to VACSecureServers™\n")
start = input("Would you like to start the program? ")
if start.lower() == "yes":
print("\n1. Display high scores\n2. Add a new high score\n3. Clear all high scores\n4. Quit")
option = input()
if option == "1":
print (file.read())
if os.stat("highscores.txt").st_size==0:
print("There are no highscores currently in the system, please return and input some.")
elif option == "2":
numberAppend = int(input("How many scores would you likes to add to the program? "))
for loop in range(numberAppend):
name = input("Enter the name of the user:")
score = input("Enter a score: ")
file.write(name+","+score+","+strftime("%d/%m/%y %H:%M:%S\n"))
elif option == "3":
open("HighScores.txt", 'w').close()
print("Highscores resetting")
sleep(0.4)
addDecimal()
sleep(0.6)
addDecimal()
sleep(0.9)
addDecimal()
sleep(1.2)
print("Successfully reset!")
sleep(2)
elif option == "4":
sys.exit()
file.close()
Это ошибка, я получаю:
Traceback (most recent call last):
File "E:\script.py", line 12, in <module>
print("\nWelcome to VACSecureServers™\n")
File: "C:\Python3\lib\encodings\cp437.py", line 19, in encode
return codecs.charmap_encode(input,self.errors,encoding_map)[0]
UnicodeEncodeError: 'charmap' codec can't encode character '\u2122' in position 29: character maps to <undefined>
Что может быть проблема?
Что вы ожидаете от этого? Что пошло не так? И можете ли вы выложить код, чтобы я был прав, и я могу его прочитать? Спасибо – doctorlove
Я сделал это, я просто новый для stackoverflow, поэтому не знал, что мне нужно использовать образец кода, чтобы вставить его. – PCGamer101
Возможно, вы захотите заменить всю эту тарабарщину фактическим описанием своей проблемы. Кроме того, отступы в столбце на 4 белых пространства позволят окрашивать. –