# Trying to read file in Mapped Network Drive

**URL:** <https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284>\
**Category:** Ignition\
**Tags:** ignition79\
**Created:** [January 14, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284 "2020-01-14T20:29:01Z")\
**Posts on this page:** 20\
**Page:** 1

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 14, 2020, 8:29pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/1 "2020-01-14T20:29:01Z")

</div>

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.

```auto
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

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

```

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 14, 2020, 8:30pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/2 "2020-01-14T20:30:55Z")

</div>

> [@dkhayes117](#):
>
> path = '\\Z:upsLogs.txt'

Path should surely be: "path = '\\Z:\upsLogs.txt'" ?

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [January 14, 2020, 8:30pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/3 "2020-01-14T20:30:57Z")

</div>

Nevermind, omg I had a typo!!

```auto
contents = system.file.readFileAsStringpath(path)

```

should be

```auto
contents = system.file.readFileAsString(path)

```

---

<div class="post-metadata">

**Author:** ![Matrix\_Engineering](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/matrix_engineering/32/19781_2.png) [@Matrix\_Engineering](https://forum.inductiveautomation.com/u/Matrix_Engineering)\
**Post date:** [January 14, 2020, 8:31pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/4 "2020-01-14T20:31:45Z")

</div>

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!

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 3:49am UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/5 "2022-12-07T03:49:04Z")

</div>

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

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 1:09pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/6 "2022-12-07T13:09:57Z")

</div>

Check this thread [Network File Sharing - Ignition - Inductive Automation Forum](https://forum.inductiveautomation.com/t/network-file-sharing/66590)  
and the manual if you haven't already.  
[Mapping a Network Drive - Ignition User Manual 8.1 - Ignition Documentation (inductiveautomation.com)](https://docs.inductiveautomation.com/display/DOC81/Mapping+a+Network+Drive)

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 8:45pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/7 "2022-12-07T20:45:57Z")

</div>

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.

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 8:52pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/8 "2022-12-07T20:52:30Z")

</div>

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.

```auto
# Enables Debug output from the Wrapper.
wrapper.debug=TRUE

```

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 9:12pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/9 "2022-12-07T21:12:31Z")

</div>

> [@dkhayes117](#):
>
> he logs in the gateway webpage und

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

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 9:15pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/10 "2022-12-07T21:15:26Z")

</div>

probably something like this

```auto
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))

```

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 9:25pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/11 "2022-12-07T21:25:58Z")

</div>

Hi,

I do not see that error in the logs

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 9:34pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/12 "2022-12-07T21:34:56Z")

</div>

Oops, I was wrong on log location

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

```

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 9:47pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/13 "2022-12-07T21:47:36Z")

</div>

> [@dkhayes117](#):
>
> ` file is in the main Ignition installation`

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

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 9:51pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/14 "2022-12-07T21:51:45Z")

</div>

How do you know it isn't working?

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 10:19pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/15 "2022-12-07T22:19:23Z")

</div>

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")

```

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 10:24pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/16 "2022-12-07T22:24:04Z")

</div>

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...

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 10:31pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/17 "2022-12-07T22:31:09Z")

</div>

> [@dkhayes117](#):
>
> ag change s

It's definitely a gateway script.

---

<div class="post-metadata">

**Author:** ![pturmel](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pturmel/32/3295_2.png) [@pturmel](https://forum.inductiveautomation.com/u/pturmel)\
**Post date:** [December 7, 2022, 10:36pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/18 "2022-12-07T22:36:49Z")

</div>

> [@josh3](#):
>
> "V:" is already defined. Trying to continue

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

---

<div class="post-metadata">

**Author:** ![dkhayes117](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/dkhayes117/32/68344_2.png) [@dkhayes117](https://forum.inductiveautomation.com/u/dkhayes117)\
**Post date:** [December 7, 2022, 10:42pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/19 "2022-12-07T22:42:01Z")

</div>

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

> [@pturmel](#):
>
> Do you have multiple mappings

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.

---

<div class="post-metadata">

**Author:** ![josh3](https://avatars.discourse-cdn.com/v4/letter/j/82dd89/32.png) [@josh3](https://forum.inductiveautomation.com/u/josh3)\
**Post date:** [December 7, 2022, 11:54pm UTC](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284/20 "2022-12-07T23:54:46Z")

</div>

Hi,

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

[Next page](https://forum.inductiveautomation.com/t/trying-to-read-file-in-mapped-network-drive/31284.md?page=2)
