Hi,
I'm new to the Ignition environment and currently working on a page using the Web Dev module. I'm trying to access some video files that are located on a network folder, but I haven't been able to get it to work.
Is it possible to access video files on a network share through the Web Dev module?
Here's a simplified version of the code I'm using:
def doGet(request, session):
# Try these alternative path formats one by one:
test_file = "Z:/Information Technology/Test_Videos/010-010/test.mp4" # Forward slashes
# test_file = r"Z:\Information Technology\Test_Videos\010-010\test.mp4" # Raw string
# test_file = "\\\\ServerName\\ShareName\\Information Technology\\Test_Videos\\010-010\\test.mp4" # UNC path
try:
import os
print("Attempting to access:", test_file) # This appears in the gateway logs
print("Path exists:", os.path.exists(test_file)) # Debug output
if not os.path.exists(test_file):
return {
'json': {'error': "File not found at: " + test_file},
'debug': {
'current_dir': os.getcwd(),
'list_dir': os.listdir(os.path.dirname(test_file))
},
'status': 404
}
return {'file': test_file, 'contentType': 'video/mp4'}
except Exception as e:
return {'json': {'error': "Access error: " + str(e)}, 'status': 500}
I've tried using different path formats, including drive letters and UNC paths, but none of them seem to work. I'm not sure if I'm missing something in terms of configuration or permissions.
Any guidance on how to properly access network files in this context would be greatly appreciated. Thank you in advance for your help!