Trying to read a cifs file (mounted) on the gateway on an Ubuntu system Ignition 8.1.18 via system.file.readFileAsBytes but don’t know the format of the path or maybe I don’t know what the path is relative to on Linux.
I know how to do it on Windows.
Here’s the script:
path = '/mnt/share/test.jpg'
bytes = system.file.readFileAsBytes(path)
but keeps saying it doesn’t exist or isn’t a file.
I realize it could be permissions issue but I can’t really find any debugging to point me in that direction and the files/folder have 777 permissions (for testing).
Your original format was correct. The path probably doesn’t exist or isn’t correct or it’s a permissions problem.
Get a terminal on the server and verify the path. Make sure you’re executing the code in gateway scope.
Yep, scope got me again. I was running in Designer. I threw it in a Gateway timer script and all is fine.
Curious what other people use to test “Gateway scope” scripts…surely there’s something better than a gateway timer script. Note that I have Edge with Compute. So no Vision. Ideas?
I usually just make a boolean tag with a tag change event script on it, and then toggle it.
Good suggestion. Thanks @Kevin.Herron
I usually make a gateway message handler and call it with
system.util.sendRequest(). You can use that in a designer script console.