OT: x character returned in filepath

the_msp

Lifetime Supporting Member
Join Date
May 2008
Location
Northern Ireland
Posts
1,271
Hello, slightly OT but I remember a thread here a while ago (that I've searched for and can't find) discussing a similar topic...

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:

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 fielname prefix (day of month). If I rename the file as simply "handling" it opens the file ok.

From the thread I was reading before it mentioned using other characters to get round this, if I add a ' it removes the x but also the backslash altogether;

Code:
filepath = "\\machine\c$\Logs\'03_filename.log"
file = open(filepath)

No such file or directory: "\\machine\c$\Logs03_filename.log"
 
Hi Russ, I tried that;

Code:
filepath = "\\machine\c$\Logs\\'03_filename.log"
file = open(filepath)

returns

'No such file or directory', "\\machine\\c$\\Logs\\'03_filename.log"

Tried a few other combinations, no joy so far.

Thanks
 
Have you tried split and concatenate?
filepath = "\\machine\c$\Logs\" + "03_filename.log"
 
Yes, but according to the ignition manual:

"This is a regular string"
'This one uses single quotes'
"This string uses \"escaping\" to include quotes inside the string"

So I then tried:

filepath = '\\machine\c$\Logs\' + "31_filename.log"

which seems to build it as the original string, something funny going on cause day 31 returns:

'No such file or directory', '\\machine\\c$\\Logs\x19_filename.log'

Will maybe give the ignitions forums a go, see if any one has seen this before there
 
It's interpreting the number as octal and returning it as hex with the hex indicator 'x' prepended. I have no idea about the rest of the stuff.
 
Last edited:

Similar Topics

So I had an odd request from a customer for the above. I have written the logic and tested it all in one PLC with only using 7 outputs and 7...
Replies
15
Views
421
This may or may not be the right fit for this forum, but I'm hoping someone can recognize my issue and help me sort this out. I'm working to...
Replies
1
Views
2,163
This is for editing HMI texts en masse in Excel. My problem is that in my HMI texts, some are in multiple lines, even if they are single texts...
Replies
26
Views
9,098
Hi. I migrated panelbuilder32 hmi to factorytalk view. However character array is not supported in ftview. Appreciate your help how to map the plc...
Replies
2
Views
1,745
Hi All, have a quick one new enough to this type of programming, I am using a Allen Bradley point IO with 1734-232ASC card to send out data, I...
Replies
5
Views
2,551
Back
Top Bottom