Unable to open network files anymore via system.net.openURL

Did something change with system.net.openURL in 7.8??

After upgrading to 7.8 we can no longer open network files.

Here is the existing code: (This code worked in 7.7)

f= '//srv-01/share/_NGB Work Orders/RS20141120-04/Attachments/VesselInventoryError.png'

if system.file.fileExists(f):
	fileToOpen = "file:///" + f

Any help would be great. The Ignition Help doesn’t explain any of this.

I think i figured it out. I think in 7.8 it deals with spaces in file paths differently.

Looks like now you need to replace spaces with ‘%20’

So this:
‘//srv-01/share/_NGB Work Orders/RS20141120-04/Attachments/VesselInventoryError.png’

Should be This:

Oh and be sure to preceed the above with ‘file:’ so your code would read like this:


Some code that works pretty well:

def open(filePath):
	#****Note:  This will error out if the path is like this:  \\server\folder\file.ext  python does not play well with '\'s
	#First Look to see if the file is on the local PC/Mapped drive or a fileshare(NFS) Path and build path prefix:  
	# For Local or Mapped drives path prefix should be:  file:///
	# For Fileshare(NFS) paths prefix should be:  file:
	prefix = ''
	path = ''
	if ':' in filePath:
		prefix = 'file:///'
		prefix = 'file:'
	print filePath
	#now make sure slashes are correct:
	if '/' in filePath:
		path = filePath
	else:  #only if the path is like so \\\\server\\folder\\file.ext
		path = filePath.replace('\\','/')  	

	#now make sure spaces in the path are accounted for with %20 instead:
	path = path.replace(' ','%20')
	#Open the File


Hi James,

Thanks for posting this code. It really helps if you put it in blocks so we can see the indenting :thumb_right:


Thanks for the tip. :slight_smile: