# File Write to a Network Location

**URL:** <https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361>\
**Category:** General Discussion\
**Created:** [October 3, 2013, 2:51pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361 "2013-10-03T14:51:46Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [October 3, 2013, 2:51pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/1 "2013-10-03T14:51:46Z")

</div>

I am trying to write a file to a network location from a gateway script. I am sure it is a permissions issue, but I’m not exactly sure how the gateway scripts differ from any other command.

I have a script in the Script Modules that writes a file. If I call the script from a button press when running the application on the gateway server, it works. If I call the script from a gateway timer, it gives a couple of possible errors.

If I attempt to write to a mapped network drive (Y:) it gives the error:  
Traceback (most recent call last):  
File “\<TimerScript:IFI\_12430\_CNCUnloadCell/tmrMain @750ms \>”, line 15, in   
File “module:Test”, line 153, in WriteTestFile  
IOError: The system cannot find the path specified

If I attempt to write directly to the network location(\\IP\folder), it gives the error:  
Traceback (most recent call last):  
File “\<TimerScript:IFI\_12430\_CNCUnloadCell/tmrMain @750ms \>”, line 15, in   
File “module:Test”, line 153, in WriteTestFile  
IOError: Logon failure: unknown user name or bad password

---

<div class="post-metadata">

**Author:** ![mgross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mgross/32/3311_2.png) [@mgross](https://forum.inductiveautomation.com/u/mgross)\
**Post date:** [October 3, 2013, 3:52pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/2 "2013-10-03T15:52:43Z")

</div>

This might help you out. The Ignition software uses a program called Java Service Wrapper to run the JVM from an native executable. There are some properties that you can add to data/ignition.conf that magically mounts a network drive so that you can use it in gateway scripts. A configuration example is at the bottom of the page [here](http://wrapper.tanukisoftware.com/doc/english/prop-share-general.html#target).

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [October 3, 2013, 4:10pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/3 "2013-10-03T16:10:27Z")

</div>

Thanks, I will give that a shot. Is there a particular location in the .conf file that I need to add the logic to? Do I need to restart the gateway before the change will take affect?

---

<div class="post-metadata">

**Author:** ![mgross](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/mgross/32/3311_2.png) [@mgross](https://forum.inductiveautomation.com/u/mgross)\
**Post date:** [October 3, 2013, 7:09pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/4 "2013-10-03T19:09:15Z")

</div>

I don’t think it matters where you put the text in the file. But yes, you do have to restart the gateway. Also, to be absolutely sure that the wrapper program reloads the .conf file, stop the gateway and then start it as separate commands rather than just restarting in 1 command.

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [October 3, 2013, 9:02pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/5 "2013-10-03T21:02:57Z")

</div>

I added the following the ignition.conf file and I saw no change. I still get the same errors.

wrapper.share.1.location=\172.18.1.30\UserFiles  
wrapper.share.1.target=Y:  
wrapper.share.1.account=username  
wrapper.share.1.password=password  
wrapper.share.1.startup.premapped=CONTINUE  
wrapper.share.1.startup.max\_retries=5  
wrapper.share.1.startup.retry\_interval=10

---

<div class="post-metadata">

**Author:** ![ceidson](https://avatars.discourse-cdn.com/v4/letter/c/9d8465/32.png) [@ceidson](https://forum.inductiveautomation.com/u/ceidson)\
**Post date:** [October 4, 2013, 1:29pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/6 "2013-10-04T13:29:52Z")

</div>

I can get the file to write from a client script as well. I can make it work by creating a stand-alone application that runs on the server, to write from a client script, but it is not ideal. What authentication would the gateway use that is different from the client?  
I should note that the remote pc and the server have different login id’s and the remote pc is in the same network, but does not log on to a domain.  
I am writing a file from the gateway to another computer on the same network with no issues. I just can’t seem to find what is different about this computer vs the one that I can write to.

---

<div class="post-metadata">

**Author:** ![Robert.McKenzie](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/robert.mckenzie/32/4134_2.png) [@Robert.McKenzie](https://forum.inductiveautomation.com/u/Robert.McKenzie)\
**Post date:** [December 26, 2013, 5:56pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/7 "2013-12-26T17:56:43Z")

</div>

The big difference between Client and Gateway scope is that a logged in user is running the Client scripts and some pre-determined user is running the Gateway scoped scripts. The latter should run through the user that the Ignition service was installed under (which is usually just ‘Local System Account’). You can change it to log on as a different user in the Windows Services program (services.msc). If your new username has permissions to access that shared folder, then it should work!

---

<div class="post-metadata">

**Author:** ![speters](https://avatars.discourse-cdn.com/v4/letter/s/eb8c5e/32.png) [@speters](https://forum.inductiveautomation.com/u/speters)\
**Post date:** [March 10, 2014, 11:56pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/8 "2014-03-10T23:56:44Z")

</div>

I had a similar application and just got it working, it was kind of a permissions issue. To make it work on a Windows 7 system, you need to run Ignition as a service, and tell it to log on not as the current user but as your local admin account. That got me the permissions I needed to make the java wrapper code work. I added in one other line to it for troubleshooting till I got it working and that was wrapper.share.1.failure=SHUTDOWN. It wouldn’t let the Ignition service start until I got the login thing figured out. I just commented it out when I wasn’t working on that part so it would run normally.

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [March 25, 2014, 2:38pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/9 "2014-03-25T14:38:10Z")

</div>

I cannot find the ignition.conf file anywhere, has this changed? Thanks

---

<div class="post-metadata">

**Author:** ![greg.simpson](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/greg.simpson/32/3135_2.png) [@greg.simpson](https://forum.inductiveautomation.com/u/greg.simpson)\
**Post date:** [April 15, 2014, 10:25pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/10 "2014-04-15T22:25:13Z")

</div>

No, this file location did not change. The ignition.conf file can be found in the installation directory of Ignition. Should look like

```
              \Program Files\Inductive Automation\Ignition\data\ignition.conf

```

this would be for Windows installations

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 11, 2014, 3:26pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/11 "2014-08-11T15:26:35Z")

</div>

I am revisiting this, I am attempting to setup a mapped network drive and have been unsuccessful. I have the log file enabled but I am not getting any errors in the wrapper.log, but its not working either.

When i try to access a file path from a gateway script I get:  
OSError: (2, ‘No such file or directory’, ‘V:\Network’)

Setup:  
windows server 2008 R2  
Ignition 7.6.4  
Mapped a windows network drive to the PC already and works fine.

Can anyone give me some suggestions to try, I’m logged in as an admin.

Thanks,  
Drew

---

<div class="post-metadata">

**Author:** ![pdibenedetto](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/pdibenedetto/32/6364_2.png) [@pdibenedetto](https://forum.inductiveautomation.com/u/pdibenedetto)\
**Post date:** [August 11, 2014, 3:49pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/12 "2014-08-11T15:49:03Z")

</div>

How you mapped the network drive?

With the iginiton.conf file or with the GUI of windows?

I think that if you do it with the second way, the mapped network only lives in the security context of your current user logged in (in this case, admin).

The Ignition Gateway Service runs as Local Service (if you not change that) and don’t see the drives mapped by admin context (I think)

Regards,

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 11, 2014, 5:18pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/13 "2014-08-11T17:18:00Z")

</div>

initially I set up the mapped drive with windows only, when my scripts failed to reach the mapped drive i found this post on the forum and set up the parameters in the ignition.conf file.

I also followed instructions at:  
[inductiveautomation.com/sup … /ignition/](https://www.inductiveautomation.com/support/usermanuals/ignition/)

Nothing shows up in the wrapper.log that says its failing or trying to connect. I am going to call support and see if they can help out

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 11, 2014, 7:04pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/14 "2014-08-11T19:04:23Z")

</div>

I am still unable to get it fully working but I’m Close. here is my current setup but i am still getting an error. The names and locations have been changed to protect the Innocent.

CONFIG:  
wrapper.share.1.location=\1.2.3.4\Network  
wrapper.share.1.target=V:  
wrapper.share.1.type=Disk  
wrapper.ntservice.account=me  
wrapper.ntservice.account=me1  
wrapper.share.1.account=here\me  
wrapper.share.1.password=me1  
wrapper.share.1.startup.premapped=CONTINUE  
wrapper.share.1.startup.max\_retries=5  
wrapper.share.1.startup.retry\_interval=10

ERROR:  
Unable to map “V:”. Trying to continue. (The network path was not found. (0x35))

---

<div class="post-metadata">

**Author:** ![drewdin](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/drewdin/32/3363_2.png) [@drewdin](https://forum.inductiveautomation.com/u/drewdin)\
**Post date:** [August 12, 2014, 1:58pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/15 "2014-08-12T13:58:40Z")

</div>

SO, now i have the drive mapped successfully but i cannot access the drive letter. Any suggestions? thx

---

<div class="post-metadata">

**Author:** ![anna](https://avatars.discourse-cdn.com/v4/letter/a/779978/32.png) [@anna](https://forum.inductiveautomation.com/u/anna)\
**Post date:** [October 22, 2014, 2:21pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/16 "2014-10-22T14:21:24Z")

</div>

Any errors?

---

<div class="post-metadata">

**Author:** ![cmaynes](https://sea1.discourse-cdn.com/inductiveautomation/user_avatar/forum.inductiveautomation.com/cmaynes/32/6852_2.png) [@cmaynes](https://forum.inductiveautomation.com/u/cmaynes)\
**Post date:** [October 31, 2017, 3:32pm UTC](https://forum.inductiveautomation.com/t/file-write-to-a-network-location/7361/17 "2017-10-31T15:32:05Z")

</div>

I had a similar issue. I was trying to write pdf bytes to a folder on our network using system.file.write().

The solution was to obviously make sure you have raw strings, and to use built-in python functions.  
…  
ReportBytes = …  
iFile = open( r’\MyServer\Folder\iPDF.pdf’, ‘wb’ )  
iFile.write( ReportBytes )  
iFile.close()
