Skip to content

Can't make it work on PMS Windows (500 for all plugin frontend content) #189

Closed

Description

@byg0n3

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?
3dvi4fm 1
hekcupx 1
system_and_webtools_logs.zip

Activity

  1. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Seems like a unicode problem, and maybe due to the path:

    C:\Users\dein0s

    What codepage/language are you running, and what's the correct path in above?

    /T

  2. self-assigned this
    on Jul 14, 2016
  3. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    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.
    yzgaavb 1

  4. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    After been authenticated towards the backend, try and issue a get like:

    http://127.0.0.1:33400/webtools2?module=wt&function=getCSS

    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" ]

  5. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    Yep.
    wfkid2r 1

  6. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    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 :-(

  7. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    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 byte

  8. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    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.

  9. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    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?

    init.py.zip

  10. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    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

  11. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    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 ;-)

  12. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    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

  13. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Darn, it still reports utf-8 :-(

    Hang in there please, while I cook up a new version of the file

  14. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    Btw, you can just provide me the code instead of new files if this suits you.

  15. 5 remaining items

  16. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Ahhh....Nice catch ;-)

  17. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    Still doesn't work with any of variants.

    wt_logs_encode_and_decode_catch_logs.zip

  18. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    Looks like setting path to icon object doesn't act like a call, so it can't reach except block.

  19. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Please try this:

    Add an import statement @ the top like:
    import locale

    Then try this:

        Log.Debug("Testing encoding: " + sys.getdefaultencoding())
        Log.Debug("Testing locale: " + locale.getpreferredencoding())
    

    And tell me what the log says

  20. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author
    2016-07-14 15:20:54,661 (6c0) :  DEBUG (logkit:13) - Testing encoding: utf-8
    2016-07-14 15:20:54,661 (6c0) :  DEBUG (logkit:13) - Testing locale: cp1251
    
  21. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Ahhhh.......Standby

  22. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner
    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)
    
  23. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    Looks good, everything working.

  24. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    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 ;-)

  25. byg0n3 commented on Jul 14, 2016

    @byg0n3
    Author

    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

  26. added this to the V2.3 milestone on Jul 14, 2016
  27. added a commit that references this issue on Jul 14, 2016
  28. ukdtom commented on Jul 14, 2016

    @ukdtom
    Owner

    Fixed with 5df58bf

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

Projects

No projects

    Milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions