invalid escape sequence \s

Greetings all. I am troubleshooting an issue on my BLE sniffer setup. While I don't 'think' this is causing my actual current failure (Wireshark not detecting COM6) I wanted to verify, if possible, that my 'fix' isn't causing more issues or just flat out wrong.

While testing the .\nrf_sniffer_ble.bat --extcap-interfaces command, I received the following error:

C:\Users\Project Help Desk\AppData\Roaming\Wireshark\extcap\nrf_sniffer_ble.py:187: SyntaxWarning: invalid escape sequence '\s'
"{validation=^\s*((37|38|39)\s*,\s*){0,2}(37|38|39){1}\s*$}{required=true}" % CTRL_ARG_ADVHOP)
C:\Users\Project Help Desk\AppData\Roaming\Wireshark\extcap\nrf_sniffer_ble.py:716: SyntaxWarning: invalid escape sequence '\s'
m = re.search("^\s*rssi\s*(>=?)\s*(-?[0-9]+)\s*$", capture_filter, re.IGNORECASE)

I checked the python code, and made the following changes:

Line 187 Installed:         "{validation=^\s*((37|38|39)\s*,\s*){0,2}(37|38|39){1}\s*$}{required=true}" % CTRL_ARG_ADVHOP)

Line 187 My Edit:          "{validation=^\\s*((37|38|39)\\s*,\\s*){0,2}(37|38|39){1}\\s*$}{required=true}" % CTRL_ARG_ADVHOP)

Line 716 Installed:         m = re.search("^\s*rssi\s*(>=?)\s*(-?[0-9]+)\s*$", capture_filter, re.IGNORECASE)

Line 716 My Edit:         m = re.search("^\\s*rssi\\s*(>=?)\\s*(-?[0-9]+)\\s*$", capture_filter, re.IGNORECASE)

So as you can see, I basically just added an additional \ to the 8 instances of \s*

Because I am troubleshooting an issue with my COM port, and because line 187 is part of get_interfaces(), it has me suspecting that my fix is just wrong. I am fairly new to Python.

My Setup:

Hardware:

Lenovo W541 Laptop

nRF52840DK with NFC Antenna installed and factory supplied USB cable from Mouser.com

Software:

Windows 10 Pro 64: 19045.3930 - Freshly installed for this project and fully updated.

Wireshark: Version 4.2.2 (v4.2.2-0-g404592842786)

nRF Connect For Desktop 4.3.0: Used for launching Programmer

Programmer 4.2.0: Used to flash firmware

Firmware File: sniffer_nrf52840dk_nrf52840_4.1.1.hex

Sniffing Program: nrf_sniffer_for_bluetooth_le_4.1.1 ------- This where I found the nrf_sniffer_ble.py file that is giving me syntax errors. ---------

Python: Python 3.12.1

Any ideas are appreciated.

Parents Reply Children
No Data
Related