2015-09-16, 20:54
There is a new bug that some users of my addon are experiencing.
When using ElementTree to parse the settings.xml file, in the log the exception reads:
Looking through the documentation, I can't find what restricted mode is, how it is invoked and what is actually restricted in restricted mode.
The background is that I need to set the allowable values (via type='labelenum') for multiple settings on the addon's Settings page at runtime. This is for a service addon, so this process is invoked at startup.
To do this, I have been loading the settings.xml file from the addon directory (Note: not the addon_data version) via xml.etree.ElementTree.parse().
I then make the changes and write settings.xml back out.
For example:
is changed at runtime so that the values="..." is changed to reflect what is actually on the user's system (details not important except that these values are arbitrary and different on each system).
Some users are getting the above error during the initial parse() call. I cannot recreate this on my own system.
I have tried to think of other ways to dynamically change these values, but have not come up with a good solution. I thought of trying to use the type="fileenum" (see: http://kodi.wiki/view/Add-on_settings#ty...ileenum.22) and creating a directory with empty files named for the allowed selections. However, the starting directory in "values" does not accept the "special://" format and it seems that the only directories allowed are subdirectories of the actual addon. So I would possibly end up in the same boat. If restricted mode does not allow read/write in the addon's directory (which is where the settings.xml file is) then I wouldn't be able to create and change this directory from within the addon's code.
Anyone have any ideas on this one?
When using ElementTree to parse the settings.xml file, in the log the exception reads:
Code:
IOError: file() constructor not accessible in restricted mode
Looking through the documentation, I can't find what restricted mode is, how it is invoked and what is actually restricted in restricted mode.
The background is that I need to set the allowable values (via type='labelenum') for multiple settings on the addon's Settings page at runtime. This is for a service addon, so this process is invoked at startup.
To do this, I have been loading the settings.xml file from the addon directory (Note: not the addon_data version) via xml.etree.ElementTree.parse().
I then make the changes and write settings.xml back out.
For example:
Code:
<setting default="Default" id="default_profile" label="32012" subsetting="true" type="labelenum" values="None|Default" visible="eq(-1,true)" />
Some users are getting the above error during the initial parse() call. I cannot recreate this on my own system.
I have tried to think of other ways to dynamically change these values, but have not come up with a good solution. I thought of trying to use the type="fileenum" (see: http://kodi.wiki/view/Add-on_settings#ty...ileenum.22) and creating a directory with empty files named for the allowed selections. However, the starting directory in "values" does not accept the "special://" format and it seems that the only directories allowed are subdirectories of the actual addon. So I would possibly end up in the same boat. If restricted mode does not allow read/write in the addon's directory (which is where the settings.xml file is) then I wouldn't be able to create and change this directory from within the addon's code.
Anyone have any ideas on this one?