Assertion Error From a common.py file for code editor

330 views Asked by At

(Please note: I am a beginner with Python) When I try to input my bssid it gives me an assertion error referencing a section of another file of code called common.py that I think comes with my code editor (thonny). How would I remedy this?

import os
import time

opsys = input("Are you using MacOS or Windows? ")

if (opsys.lower() == "windows"): 
    print("\n Alrighty, let me just open u your command prompt for you.") 
    time.sleep(0.5)
    os.system("start /B start cmd.exe @cmd /k netsh wlan show interfaces")
    time.sleep(0.25)
    bssid = input("\nNow paste in the set of numbers labelled BSSID: ")
    print("Thanks")

Here is the statement the assertion error is referencing from common.py:

def parse_message(msg_string: str) -> Record:
    # DataFrames may have nan
    # pylint: disable=unused-variable
    nan = float("nan")  # @UnusedVariable
    assert msg_string[0] == MESSAGE_MARKER
    return eval(msg_string[1:].encode("ASCII").decode("UTF-7"))

Here is the entire traceback error:

Traceback (most recent call last):
  File "C:\Users\tjmon\Documents\Honors Comp Sci\Other Programs\Lab3.py", line 60, in <module>
    bssid = input("\nNow paste in the set of numbers labelled BSSID: ")
  File "C:\Users\tjmon\AppData\Local\Programs\Thonny\lib\site-packages\thonny\common.py", line 220, in parse_message
    assert msg_string[0] == MESSAGE_MARKER
AssertionError
1

There are 1 answers

1
Kevin Kendzia On

So in common.py its referenced as MESSAGE_MARKER = "\x02", which means something like "Start of Text"

Oct  Dec Char  Hex  Key     Comments
\000   0  NUL  \x00  ^@ \0 (Null byte)
\001   1  SOH  \x01  ^A    (Start of heading)
\002   2  STX  \x02  ^B    (Start of text)

Maybe it's just a error in thonny - did you try your program without it?