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

Hi, I am having a similar problem.

Can anyone help me confirm the syntax required?

Mapping a Network Drive

#********************************************************************

wrapper.share.1.location=\Server
wrapper.share.1.target=V:
wrapper.share.1.type=DISK

Check this thread Network File Sharing - Ignition - Inductive Automation Forum
and the manual if you haven't already.
Mapping a Network Drive - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)

1 Like

Hi,

I've used the "net use" command on the server and discovered that the syntax should be:
V:\Server\Site_Brooklyn

I've updated the conf file, stopped, and started the gateway but to no avail.

Uncomment the wrapper debugging line in the config file then start and stop again. Then after the gateway starts back up, check the logs in the gateway webpage under Diagnostics > Logs.

# Enables Debug output from the Wrapper.
wrapper.debug=TRUE
1 Like

Hi,
thanks for the tip, what am i searching for in the logs?

probably something like this

wrapper | Attempting to map the "\\fileserver\folder" share to "S:"...
wrapper | Unable to map "S:". Attempt #1 (The network name cannot be found. (0x43))
wrapper | Attempting to map the "\\fileserver\folder" share to "S:"...
wrapper | Unable to map "S:". Trying to continue. (The network name cannot be found. (0x43))

Hi,

I do not see that error in the logs

Oops, I was wrong on log location

The location of the log file is in the main Ignition installation folder as wrapper.log.

DEBUG | wrapper | 2022/12/08 08:28:26 | Network Mapping Details:
DEBUG | wrapper | 2022/12/08 08:28:26 | Location: \Server\Site_Brooklyn
DEBUG | wrapper | 2022/12/08 08:28:26 | Target: V:
DEBUG | wrapper | 2022/12/08 08:28:26 | Account: <N/A> (Password: <N/A>)
DEBUG | wrapper | 2022/12/08 08:28:26 | Type: DISK
DEBUG | wrapper | 2022/12/08 08:28:26 | Startup:
DEBUG | wrapper | 2022/12/08 08:28:26 | On Failure: CONTINUE
DEBUG | wrapper | 2022/12/08 08:28:26 | On Premapped: CONTINUE
DEBUG | wrapper | 2022/12/08 08:28:26 | Max Retries: 5
DEBUG | wrapper | 2022/12/08 08:28:26 | Retry Interval: 10
DEBUG | wrapper | 2022/12/08 08:28:26 | Shutdown:
DEBUG | wrapper | 2022/12/08 08:28:26 | Unmap: FALSE (Force: FALSE)
INFO | wrapper | 2022/12/08 08:28:26 | Attempting to map the "\Server\Site_Brooklyn" share to "V:"...
INFO | wrapper | 2022/12/08 08:28:26 | "V:" is already defined. Trying to continue

How do you know it isn't working?

Hi,

I'm not 100% sure tbh. this the first in the script being called:
def Read_CSV_File(filePath):
rows=
listDict=
import csv
try:
with open(filePath,"r") as csvFile:
csvData= csv.DictReader(csvFile,header)

        for row in csvData:
                 
            listDict.append(row)

    return listDict
except:  
    Error("Failed to read Item Master CSV")

The wrapper config maps a drive to Ignition on the gateway. So for it to work the script must be called in a gateway scope ie tag change script, gateway event script...

1 Like

It's definitely a gateway script.

Do you have multiple mappings all trying to use "V" ?

Remove the try except so you can get the backtrace when it fails, which will be in gateway logs.

I think this happens when you map a network drive on the gateway computer as X: then map it with ignition using the same X letter. I think I've done this myself, but it still works.

1 Like

Hi,

Not on the gateway server. I do on my base computer.