Próbuję zrobić Konsolowy menadżer plików ale wyskakuje mi error:
Traceback (most recent call last):
File "C:\Users\Tomasz\Desktop\Programowanie\Pynux123.py", line 11, in <module>
print(f.read())
^^^^^^^^
File "C:\Program Files\Python312-32\Lib\encodings\cp1250.py", line 23, in decode
return codecs.charmap_decode(input,self.errors,decoding_table)[0]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
UnicodeDecodeError: 'charmap' codec can't decode byte 0x98 in position 116: character maps to <undefined>```
Kod:
Default_Dir = r"C:\Users\Tomasz"
Default_Cmd = Default_Dir + ">"
while True:
Cmd = input(Default_Cmd)
if Cmd.startswith("open "):
Command = Cmd.replace('open ', '', 1)
print(Default_Dir + "\\" + Command)
try:
f = open(Default_Dir + "\\" + Command, "r")
print(f.read())
except OSError:
print("OPENING FILE FAILED")
Może ktoś pomóc?