Missing semicolon error when there really is one

Any of you Windows users know why this returns an error when it clearly has a semicolon:

cmdStr = "C:\Users\s\.venv\Scripts\py5-run-sketch.exe";

Error:
err

What can I do to get around it?

The \ can be interpreted as an escape character inside "".
Safest way is to do a double \\ if you meant an actual \.

3 Likes

Thanks. Never would have thought to use double back slashes for each one. It works now.

1 Like

Hello folks!

For visitors to topic.

The backslash \ is an escape character and not the only one!

Issues with it come up and it is worthy of adding to a checklist when coding or otherwise!

Adding some related references to the topic.

References:

It comes up in topics and worth putting on a checklist:

From the last link above this is a screen grab (image):

This is what happens to the text when you quote it and paste it:

Same thing happened to me!

:)

2 Likes