Filepath in script

I am trying to open a file using Ignition’s scripting

the format of the filepath is:

Code:

filepath = “\machine\c$\Logs\03_filename.log”
file = open(filepath)

but the console returns:

Quote:
No such file or directory: “\machine\c$\Logs\x03_filename.log”

The problem as you can see it is adding the character “x” before the filename prefix (day of month). If I rename the file as simply “filename” it opens the file ok. Day 31 returns “x19”

If I add a ’ it removes the x but also the backslash altogether;

Code:

filepath = “\machine\c$\Logs’03_filename.log”
file = open(filepath)

Quote:
No such file or directory: “\machine\c$\Logs03_filename.log”

Tried to split and concatenate, with both single and double quotes, or a mix, some add a space into the result returned and some return the original result

Backslashes are special in python (and C, and Java, and …). You need to double them up in string constants.

Or change \ to / and let the file system deal with it…

So simple when you know how… tried both, both worked… thanks!