← index #17075Issue #15420
Off-topic · high · value 4.731
QUERY · ISSUE

Syntax Error when using multiline f-strings on RP2040 with MicroPython v1.23.0

openby kpg141260opened 2025-04-04updated 2025-10-03
bugproposed-close

Port, board and/or hardware

RP2040 Raspberry Pi Pico

MicroPython version

MicroPython Version: v1.23.0 (2024-06-02)
RP2040 Platform: Raspberry Pi Pico
Python Version: MicroPython (RP2040)
Firmware: v1.23.0
Hardware: Raspberry Pi Pico (RP2040)

Reproduction

msg = (
    f'One ' 
    f'Two ' 
    f'Three'
)

print(msg)

Expected behaviour

The above code should print the concatenated string One Two Three without any syntax errors, similar to how it works in standard Python environments.

Observed behaviour

SyntaxError: invalid syntax

Additional Information

This issue persists even when re-typing the code, leading me to suspect it might be an issue with the way multiline f-strings are handled on this particular platform.

The issue can be resolved by concatenating the f-strings manually using +:

msg = (
    f'One ' +
    f'Two ' +
    f'Three'
)

print(msg)

Workaround:

Using string concatenation (as shown above) works, but this is not as elegant and adds unnecessary complexity compared to expected behaviour.

What else I have tried:

Testing with other Python environments (such as standard Python 3.x) shows that the multiline f-string works as expected.

This issue does not occur with simpler, single-line f-strings.
Ensuring no invisible characters or incorrect syntax in the code.

Code of Conduct

Yes, I agree

CANDIDATE · ISSUE

BLE with multiple periperals (OSError: [Errno 107] ENOTCONN)

openby BaseCrusheropened 2024-07-07updated 2024-07-08
bugport-rp2

Port, board and/or hardware

Raspberry Pi Pico W

MicroPython version

MicroPython v1.23.0 on 2024-06-02; Raspberry Pi Pico W with RP2040

Reproduction

  1. Connect to a BLE peripheral using BLE.gap_connect. This works flawlessly
  2. Connect to a second BLE peripheral using BLE.gap_connect, while still connected to the first peripheral. (Error)

Expected behaviour

Connections to both peripherals is possible without any errors

Observed behaviour

OSError: [Errno 107] ENOTCONN

Additional Information

No, I've provided everything above.

Code of Conduct

Yes, I agree

Keyboard

j / / n
next pair
k / / p
previous pair
1 / / h
show query pane
2 / / l
show candidate pane
c
copy suggested comment
r
toggle reasoning
g i
go to index
?
show this help
esc
close overlays

press ? or esc to close

copied