Syntax Errors when using f-string in Cpython Dynamo Revit 2024

Hi everyone,

I ran into an issue where f-strings were not working as expected in Dynamo’s CPython environment. After some investigation, I realized that the ability to use backslashes within expressions in f-strings (inside curly braces) was introduced in Python 3.12. However, Dynamo for Revit 2024 currently uses Python 3.9, which doesn’t support this feature.

This mismatch caused my code to fail unexpectedly. While troubleshooting, I discovered the root cause, and I thought it might be helpful to share it here for others who might face a similar problem.

Here are a few snapshots of the errors I encountered while using f-strings in Dynamo CPython. Hopefully, this helps shed light on the issue and can save someone else the debugging time!




Thanks,
Nirmal