Trying to read file in Mapped Network Drive

I’m trying to read a text file in a mapped network drive named Z:. I altered the Ignition.conf file to configure the network drive. When I reviewed the wrapper logs to see if it connected successfully, I saw this so it seems it worked.

INFO   | wrapper  | 2020/01/14 14:36:44 | Attempting to map the "\\10.10.0.117\upsTagInfo" share to "Z:"...
INFO   | wrapper  | 2020/01/14 14:36:44 |   Mapped "Z:".

Whenever I run this script to read the file and write it to a tag, it fails

path = '\\\\Z:upsLogs.txt'
try:
	contents = system.file.readFileAsStringpath(path)
except:
	contents = 'failed'
		
system.tag.write('UPS/cushions',contents)

Path should surely be: “path = ‘\\Z:\upsLogs.txt’” ?

Nevermind, omg I had a typo!!

contents = system.file.readFileAsStringpath(path)

should be

contents = system.file.readFileAsString(path)

Glad you got sorted, and p.s. I forgot to enclose in a code block so the format of my suggested path is also wrong!

1 Like