You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
Can't make it work on PMS Windows (500 for all plugin frontend content) #189
Was running PMS for like 5 month or so. Few days ago tried to install web tools for the first time and faced with this problem. Firstly, I thought that it can be related to my PMS, due to my own channel scripting, so I decided to remove it and make a fresh installation. Unfortunately, it didn't help.
Also, everything working fine on my virtualbox with Linux Mint on the board.
Any ideas or suggestions? system_and_webtools_logs.zip
Does that return an array with css files?
Like: [ "trumpy81-Aussie.css", "trumpy81-ItsPink.css", "trumpy81-Plex.css", "trumpy81-Teal.css", "trumpy81-ItsRed.css", "trumpy81-ItsBlue.css", "trumpy81-ItsGreen.css", "trumpy81-theme1.css" ]
2016-07-14 11:38:06,973 (25a8) : CRITICAL (core:574) - Exception (most recent call last): File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py", line 843, in handle_request result = f(**d) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\handlers\resources.py", line 83, in resource return Framework.objects.DataObject(self._core, resource, Framework.utils.guess_mime_type(resource_name)) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\utils.py", line 40, in guess_mime_type mtype = mimetypes.guess_type(filename)[0] File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 294, in guess_type init() File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 355, in init db.read_windows_registry() File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 259, in read_windows_registry for ctype in enum_types(mimedb): File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 249, in enum_types ctype = ctype.encode(default_encoding) # omit in 3.x! UnicodeDecodeError: 'utf8' codec can't decode byte 0xe0 in position 0: invalid continuation byte
As far as I remember (investigated it also some time ago), this was only affecting images from ./Contents/Resources/
In a result - custom icons are not displayed for channels, but that's all. Everything else works without problems.
Since I haven't got a russian windows, I need you to work with me here ;-)
Make a backup of the file named __init__.py located in the WT Install dir/Contents/Code, and then replace it with the attached one.
Restart PMS, and after WT is up running again, I need the WT logs once more.
Also please tell me if attached makes a difference at all?
Was thinking about some monkeypatching of included mimetypes.py, but it seems that your code do the right magic :) sys.setdefaultencoding("cp1251")
Everything works now.
2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - ******* Started WebTools V2.2 on Windows *********** 2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - Testing encoding: utf-8 2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - Default set to cp1251
Logs please, since I need to make it work only on Windows, and need something to detect, instead of just forcing it to russian, since that will break it for everybody else not running russian ;-)
def Start():
global SECRETKEY
global VERSION
global DEBUGMODE
# Switch to debug mode if needed
debugFile = Core.storage.join_path(Core.app_support_path, Core.config.bundles_dir_name, NAME + '.bundle', 'debug')
DEBUGMODE = os.path.isfile(debugFile)
if DEBUGMODE:
VERSION = VERSION + ' ****** WARNING Debug mode on *********'
print("******** Started %s on %s **********" %(NAME + ' V' + VERSION, Platform.OS))
Log.Debug("******* Started %s on %s ***********" %(NAME + ' V' + VERSION, Platform.OS))
if (Platform.OS == 'Windows' and locale.getpreferredencoding() == 'cp1251'):
sys.setdefaultencoding("cp1251")
Log.Debug("Default set to cp1251")
HTTP.CacheTime = 0
DirectoryObject.thumb = R(ICON)
ObjectContainer.title1 = NAME + ' V' + VERSION
Plugin.AddViewGroup('List', viewMode='List', mediaType='items')
ObjectContainer.view_group = 'List'
makeSettings()
# Get the secret key used to access the PMS framework ********** FUTURE USE ***************
SECRETKEY = genSecretKeyAsStr()
startWeb(SECRETKEY, VERSION, DEBUGMODE)
Thanks for working with me on this.
I pinged Plex and asked for an update of the bundled Python, but not getting my hopes up too high here, so regardless, I'll make sure the next version of WebTools has the workaround from above ;-)
Thank you too for such collaboration :)
Now will do some fixes for my own channels regarding to this issue.
Also hope that plex devs will update python in their distribution. And maybe will finally provide fully updated documentation for their framework and api :D
Activity
ukdtom commentedon Jul 14, 2016
Seems like a unicode problem, and maybe due to the path:
C:\Users\dein0sWhat codepage/language are you running, and what's the correct path in above?
/T
byg0n3 commentedon Jul 14, 2016
System-wide language is Russian (cp1251).
Direct path looks like this:
c:\Users\dein0s\AppData\Local\Plex Media Server\Plug-ins\WebTools.bundle\Never had any problems with this username. Latin chars, number, no spaces. What can go wrong?
Also, looks like backend working as intended. I can send POST on login with no problems.

ukdtom commentedon Jul 14, 2016
After been authenticated towards the backend, try and issue a get like:
http://127.0.0.1:33400/webtools2?module=wt&function=getCSSDoes that return an array with css files?
Like:
[ "trumpy81-Aussie.css", "trumpy81-ItsPink.css", "trumpy81-Plex.css", "trumpy81-Teal.css", "trumpy81-ItsRed.css", "trumpy81-ItsBlue.css", "trumpy81-ItsGreen.css", "trumpy81-theme1.css" ]byg0n3 commentedon Jul 14, 2016
Yep.

ukdtom commentedon Jul 14, 2016
Hmmm......
https://bugs.python.org/issue9291
So need some time to dig into this, and not sure it's something I can fix, since python comes with PMS :-(
ukdtom commentedon Jul 14, 2016
And the problem, FUI according to your log:
2016-07-14 11:38:06,973 (25a8) : CRITICAL (core:574) - Exception (most recent call last): File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\components\runtime.py", line 843, in handle_request result = f(**d) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\handlers\resources.py", line 83, in resource return Framework.objects.DataObject(self._core, resource, Framework.utils.guess_mime_type(resource_name)) File "C:\Program Files (x86)\Plex\Plex Media Server\Resources\Plug-ins-a17e99e\Framework.bundle\Contents\Resources\Versions\2\Python\Framework\utils.py", line 40, in guess_mime_type mtype = mimetypes.guess_type(filename)[0] File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 294, in guess_type init() File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 355, in init db.read_windows_registry() File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 259, in read_windows_registry for ctype in enum_types(mimedb): File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\mimetypes.py", line 249, in enum_types ctype = ctype.encode(default_encoding) # omit in 3.x! UnicodeDecodeError: 'utf8' codec can't decode byte 0xe0 in position 0: invalid continuation bytebyg0n3 commentedon Jul 14, 2016
As far as I remember (investigated it also some time ago), this was only affecting images from
./Contents/Resources/In a result - custom icons are not displayed for channels, but that's all. Everything else works without problems.
ukdtom commentedon Jul 14, 2016
Since I haven't got a russian windows, I need you to work with me here ;-)
Make a backup of the file named
__init__.pylocated in the WT Install dir/Contents/Code, and then replace it with the attached one.Restart PMS, and after WT is up running again, I need the WT logs once more.
Also please tell me if attached makes a difference at all?
init.py.zip
byg0n3 commentedon Jul 14, 2016
Was thinking about some monkeypatching of included mimetypes.py, but it seems that your code do the right magic :)
sys.setdefaultencoding("cp1251")Everything works now.
2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - ******* Started WebTools V2.2 on Windows *********** 2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - Testing encoding: utf-8 2016-07-14 14:29:00,773 (12f8) : DEBUG (logkit:13) - Default set to cp1251ukdtom commentedon Jul 14, 2016
Logs please, since I need to make it work only on Windows, and need something to detect, instead of just forcing it to russian, since that will break it for everybody else not running russian ;-)
byg0n3 commentedon Jul 14, 2016
Yeah, sure! Almost forgot about them on that happy train.
And now it even loads images from
./Contents/Resources/Seems like plex devs need to update python they provide.
wt_logs.zip
ukdtom commentedon Jul 14, 2016
Darn, it still reports utf-8 :-(
Hang in there please, while I cook up a new version of the file
byg0n3 commentedon Jul 14, 2016
Btw, you can just provide me the code instead of new files if this suits you.
5 remaining items
ukdtom commentedon Jul 14, 2016
Ahhh....Nice catch ;-)
byg0n3 commentedon Jul 14, 2016
Still doesn't work with any of variants.
wt_logs_encode_and_decode_catch_logs.zip
byg0n3 commentedon Jul 14, 2016
Looks like setting path to icon object doesn't act like a call, so it can't reach except block.
ukdtom commentedon Jul 14, 2016
Please try this:
Add an import statement @ the top like:
import localeThen try this:
And tell me what the log says
byg0n3 commentedon Jul 14, 2016
ukdtom commentedon Jul 14, 2016
Ahhhh.......Standby
ukdtom commentedon Jul 14, 2016
byg0n3 commentedon Jul 14, 2016
Looks good, everything working.
ukdtom commentedon Jul 14, 2016
Thanks for working with me on this.
I pinged Plex and asked for an update of the bundled Python, but not getting my hopes up too high here, so regardless, I'll make sure the next version of WebTools has the workaround from above ;-)
byg0n3 commentedon Jul 14, 2016
Thank you too for such collaboration :)
Now will do some fixes for my own channels regarding to this issue.
Also hope that plex devs will update python in their distribution. And maybe will finally provide fully updated documentation for their framework and api :D
Fixed issue #189
ukdtom commentedon Jul 14, 2016
Fixed with 5df58bf