Network File Sharing

I am trying to establish network file share and move files from one folder to another. I updated ignition config file and able to do it in script console. But the script doesn't work in Tags value changed scripting. The goal is search a file in a file share based on tag value and move it to another folder. But when I run the script in the Tag Value Change,

disk = 'Y:'
dirname = "Y:\Test_Ignition\Data"
isdir = os.path.isdir(dirname)
system.tag.writeBlocking("[default]ALSO Testing/Status_Directory", isdir)

the directory doesn't exit. It works well in in script console though. Need guidelines, thank you.

You say you changed your Ignition config file, but did you stop and start your gateway afterwards? The script console will run in the client scope, so it seems your directory is accessible on your local computer.

The tag change scripts run on the gateway; therefore, your gateway still does not have that drive mapped correctly.

1 Like

The user that Ignition is running as might not have access to the file share. Try adding os.system("net use \\\\sharepath password /USER:\\username") before you do the os.path.isdir().

I did stop and start ignition.bat in CMD. I used the dummy credentials provided by IT department in the config file. I am looking for guideline to map the drive in the gateway. Thank you for the reply :slight_smile:

Its working in script console with return value 2 but not in a tag. I don't know which piece I am missing here to make this happen. This drive access the key for the rest of the work.

I also tried subprocess lib, its also not working.

If you are still getting directory doesn't exist error, the drive is still not mapped correctly.
Is this drive mapped on your local computer (where your designer is running)?
The script console will look for the Y: drive on your computer not the gateway computer where Ignition is hosted.

Yes its mapped on local drive as Y://

Thats why it works in the script console.
Your problem is it isn't mapped correctly with the Ignition service.
What does your Ignition config look like for the mapped drive part?

wrapper.share.1.location=\fs-01\Engineering\Test_Ignition
wrapper.share.1.target=Y:
wrapper.share.1.type=DISK
wrapper.ntservice.account=daniel
wrapper.ntservice.password=pass123!
wrapper.share.1.account=daniel
wrapper.share.1.password=pass123!

wrapper.share.1.shutdown.unmap=TRUE
wrapper.share.1.startup.max_retries=2
wrapper.share.1.startup.retry_interval=10
wrapper.share.1.startup.failure=SHUTDOWN

In my laptop, the drive is mapped as Y and I tried assigning W for the target. Wrapper log info its mapped as W:

You have your share location as wrapper.share.1.location=\fs-01\Engineering\Test_Ignition
then you are using Y:\Test_Ignition\Data. Wouldn't that mean you are trying to access \fs-01\Engineering\Test_Ignition\Test_Ignition\Data which is not the correct path.

Thank you dkhayes117, I did the changes and it worked. I was confused with script console and gateway call while editing config. I am a newbie to both Ignition and python with base of PLC. Thank you so much :slight_smile:

1 Like

Great, glad it's working! Don't worry about being new to Ignition, we've all been there :slight_smile:

1 Like