Access a network drive

Does Ignition have read rights to that folder?

https://docs.inductiveautomation.com/display/DOC81/Mapping+a+Network+Drive

2 Likes

You will have to create a mapping of it. So that it appears under your devices/drives instead of under network.


And seems you need to put in some configs too as @Matrix_Engineering linked

1 Like

Look closer at Parya’s screenshot for the “F:”. The Ignition gateway runs as a service and has no access to any desktop user’s mappings. Mappings must be established in the service.

2 Likes

I’m not super familiar with windows, how do you see that ?

1 Like

To whom are you replying to sorry?

The Ignition service can have a map linked as per the documentation link I posted (edit the ignition.conf file).

We can see that Parya’s link is a network location as per their screenshot with the red circled item.

2 Likes

I have done this as well, though I have accomplished this in kind of a strange way. See my reply to the thread below:

In this case, rather than accessing the files from the webserver/webapps/main directory, you would just be checking the contents with the os.listdir() function I mentioned in my previous post.

Edit: I guess there’s no real reason why you’d need to create a symbolic link within the Ignition install directory, you could create it anywhere on the gateway machine.

1 Like

deleted

I changed the config file but I get an error.

org.python.core.PyException
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value
caused by IllegalArgumentException: Cannot create PyString with non-byte value

Here is what I did:
In the config file, I added:

wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK


wrapper.ntservice.account=username
wrapper.ntservice.password=pass
wrapper.share.1.account=domain\username
wrapper.share.1.password=pass

Then stop/start the gateway and I used the script below for my button:

	import os
	folder = "\\fileserver\Automation\..."
	fileList = os.listdir(folder)
	self.getSibling("TextArea").props.text=fileList

You don’t put quotes into the conf for a file path, and also no 3 dots, for the full folder it is:

wrapper.share.1.location=\\fileserver\Automation\

I just did that for the demonstration only. I put the actual full path there, also since the location path has spaces, I need to wrap the value in double quotes

Try:

        import os
	folder = "D:\"
	fileList = os.listdir(folder)
	self.getSibling("TextArea").props.text=fileList
1 Like

When I write the script below in the config file:

wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

It means that I should be able to see that folder in my D drive, correct? If this is the case, I do not see any new folder that has been added to my D drive.

No, you are telling Ignition service that if a script looks for contents of D:\ then is it as \fileserver\Automation\

It does not create a windows mapped drive

1 Like

Just for clarity, the share location should be an already existing folder and the target is the alias by which Ignition accesses that folder.

1 Like

So as an example:

If I have a folder in my network drive with some images in it like:

\\fileserver\Automation\MES Ignition for program\sample Image

When I write this:

wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

I need to have a folder set up with the same images and folder path in my D drive too? It is a bit confusing what needs to be done. Let’s say now I have a new folder in my D drive, then do I need to change the script below?

wrapper.share.1.location="\\fileserver\Automation\..."
wrapper.share.1.target=D:
wrapper.share.1.type=DISK

This does nothing.

wrapper.share.1.location="\\fileserver\Automation\"

will grant access to:

\\fileserver\Automation\MES Ignition for program\sample Image.jpg

If you already have a mapped drive called D on your server, is it the one that has the Automation folder that you want Ignition access to?

1 Like

Ignition runs as a service, so it can’t access mapped drives on the host computer. Instead, you map it inside Ignition to allow for access. You don’t need D: to be mapped on the host, you just do the config file addition then stop and start Ignition. It should then be mapped and accessible from Ignition as D:\sampleImage.png

1 Like

So this is what I want to do:

There is a folder in my network drive with some pictures in it. I would like to be able to access that folder and get the picture names and put it on a list

I did not configure anything in my D drive and I did not create any folders on my D drive.

How is this going to be possible?

wrapper.share.1.location="\\fileserver4\Automation\"
wrapper.share.1.target=I:
wrapper.share.1.type=DISK
    import os
	input_path = "I:\"
	fileList = os.listdir(input_path)
	self.getSibling("TextArea").props.text=fileList
1 Like

I get the same error:

org.python.core.PyException
java.lang.IllegalArgumentException: Cannot create PyString with non-byte value

java.lang.IllegalArgumentException: java.lang.IllegalArgumentException: Cannot create PyString with non-byte value

	caused by IllegalArgumentException: Cannot create PyString with non-byte value