I have a gateway scheduled script with the following script:
def onScheduledEvent():
tbl = system.db.runNamedQuery('Project_Name', 'select_LastWeek_Data')
csv = system.dataset.toCSV(tbl)
startDater = system.date.addDays(system.date.now(), -7)
startDate = system.date.format(startDater, 'YYYYMMddHHmmss')
endDate = system.date.format(system.date.now(), 'YYYYMMddHHmmss')
filePath = "\\enterprise.domainName.net\shares\someFolder\someOtherFolder\Reports\TestFile2.csv"
system.file.writeFile(filePath, csv)
And I can see the SUCCESS message in the gateway scripts.
![image](https://global.discourse-cdn.com/inductiveautomation/original/3X/4/0/40a53a689d4d0bcd361f599793d0321ffe51ae77.png)
However, my file never appears in the given file path.
Any thoughts on what I am doing wrong?
Not sure if this is the issue, but I'd expect this path is missing all the backslashes it needs:
filePath = "\\\\enterprise.domainName.net\\shares\\someFolder\\someOtherFolder\\Reports\\TestFile2.csv"
Error message this time:
Traceback (most recent call last):
File "<Export__History_to_Excel>", line 15, in onScheduledEvent
IOError: [Errno 2] File not found - \\enterprise.domainName.net\shares\BEL\someFolder\someOtherFolder\Reports\TestFile2.csv (Access is denied)
8.1.32 (b2023091211)
Azul Systems, Inc. 11.0.18
Well now you have a real problem to track down.
Maybe you need to map the network drive? Mapping a Network Drive - Ignition User Manual 8.1 - Ignition Documentation
We did do that... we added the following to the bottom of the config file and stopped / started the gateway.
wrapper.share.1.location=\\serverName.global.domainName.net\public
wrapper.share.1.target=W:
wrapper.share.1.type=DISK
wrapper.share.1.account=ts\myUserName
wrapper.share.1.password=********
I then update my gateway script to the following:
filePath = "W://Reports//TestFile2.csv"
system.file.writeFile(filePath, csv)
I can navigate to the path [\serverName.global.domainName.net\public\Reports] so I know it exists. I get this error when running the updated gateway script:
Traceback (most recent call last):
File "<Export_History_to_Excel>", line 16, in onScheduledEvent
IOError: [Errno 2] File not found - W:\Reports\TestFile2.csv (Access is denied)
8.1.32 (b2023091211)
Azul Systems, Inc. 11.0.18
My assumption is I setup the config file wrong but I don't know how to prove it. Any thoughts? The lines of code I added are on the bottom of the config file.
It looks right, it just seems like a permissions problem at this point... maybe somebody else or support has dealt with a similar situation.
1 Like