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)
print len(bytes)
but keeps saying it doesn’t exist or isn’t a file.
I’ve tried:
//mnt//share//test.jpg
//mnt/share//test.jpg
\mnt\share\test.jpg
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).
Any ideas?
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?
3 Likes
I usually just make a boolean tag with a tag change event script on it, and then toggle it.
1 Like
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.