Код: Выделить всё
def getprompt(ser, addr, verbose, shell):
# Send a command who does not produce a result so when receiving the next line feed, only show the prompt will be returned
# Flushing read buffer
if not shell:
buf = ""
while True:
oldbuf = buf
buf = ser.read(256);
combined = oldbuf+buf
if "machid: 8010001" in combined:
ser.write("xyzzy");
while ser.read(256):
pass
break
if verbose:
print("Waiting for a prompt...")
while True:
# Write carriage return and wait for a response
ser.write(LINE_FEED)
# Read the response
buf = ser.read(256);
if (buf.endswith(b"> ") or buf.endswith(b"# ")):
print("Prompt is '" + buf[2:] + "'")
# The prompt returned starts with a line feed. This is the echo of the line feed we send to get the prompt.
# We keep this linefeed
return buf
else:
# Flush read buffer
while True:
buf = ser.read(256)
if (buf.endswith(b"> ") or buf.endswith(b"# ")):
print("Prompt is '" + buf[2:] + "'")
# The prompt returned starts with a line feed. This is the echo of the line feed we send to get the prompt.
# We keep this linefeed
return buf
pass
https://drive.google.com/drive/folders/ ... 0YQK6OdbSS
, в котором используется файл "wbootwrite.py" " внутри папки, и когда я запускаю его на своем Raspberry Pi, он выдает эту ошибку
Файл "/home/user/mr30h/MR33/ubootwrite/./ubootwrite.py", строка 34
в то время как Верно:
TabError: непоследовательное использование табуляции и пробелов в отступах.
Как это исправить? Я новичок в Python
Подробнее здесь: https://stackoverflow.com/questions/790 ... e-function