Access perspective theme folder in web dev python endpoint


I want to get access to the theme folder of perspective web dev, in a python endpoint.
What is the correct URL and syntax for that?
For example, the http://gatewayIP:8088/main/ give me access to the ignition webserver folder but there is no doc for the theme folder.

If you look around the forum for the IgnitionGateway method, you can use it to retrieve the SystemManager, which has a getDataDir() method - that method will give you the start of a tree, which you could walk down to get to the themes directory.


Thanks Paul
Could you please write a short snippet code for me. To show how to import and use it. I’m not java export.


themes = context.systemManager.dataDir.toPath().resolve("modules").resolve("com.inductiveautomation.perspective").resolve("themes")

1 Like

Hi Paul,
I get this error:

I cant get IgnitionGateway object.

This would only be possible executing in gateway scope.

Is console run code in gateway scope?
By the way how about web dev scope? is it gateway scope or not?

WebDev is gateway scope. The console is not (it’s designer, which is like client, but a little different because it’s in the designer).

1 Like

I am able to run this in a Perspective session scope to see the contents of the theme files:

from com.inductiveautomation.ignition.gateway import IgnitionGateway
context = IgnitionGateway.get()
filePath = str(context.systemManager.dataDir.absoluteFile).replace('\\','/') + '/modules/com.inductiveautomation.perspective/themes/dark.css'
return system.file.readFileAsString(filePath)