Repository navigation
Scanner does not work with python3 on linux #505
Description
Activity
- added a commit that references this issue
on Dec 30, 2024 This change breaks all python2 installations. i.e. this has broke https://hub.docker.com/r/linuxserver/plex on version 1.41.3.9314
Please consider revert this PR.
Also, how did you run this script with python3? Which python version did you use? I might missed it but when did Plex started supporting python3?
Also, this script is full of py2 tricks, string syntax is not the only thing would break with py3. I'd be really surprised if you actually got this to work with a py3 installation.
@ZeroQI may want to take a look
@TransparentBeing Thanks for the report, this can be reverted if it has broken python2.
Regarding python3, I am running plex on an Ubuntu 22.04 (jammy) system that does not have python2 installed. I can't speak to when or if plex added explicit support, but the script appears to work for my use case (all I want is for plex to extract episode name metadata from filenames and that's what I'm getting).
To test python3 compatibility, I used the
py_compilemodule to invoke bytecode compilation without running the script as shown above. I also ran2to3on the script and its almost exclusively removing theuprefix from strings, akau"string"to"string". Technicallyuis optional in python3 so that's not an issue. There is existing python2/python3 handling in the script, so I figured python3 was already supported. What specifically do you think should break on python3 besides what I already fixed?AFAIK plex bundles it's own python (or at least for some server installations), so it may not matter if you have python2 installed via the package manager or not. It's highly likely you're running python2 under the hood unless you can find python3 specific error messages in logs. Please note this is just my speculation, as plex doesn't publish documentations. I suggest double checking logs in order to pin point why ASS did not work for you before this PR.
As for how things is not broken for you after this PR, removing
ufrom regex will not break all case, as howuis suppose to work, it will only break in situations where unicode in involved.I took a quick look at the script, it is just very far from compatible with python3. Just a few examples things WILL break with py3:
- the usage of
unicodetype - compare
Nonewith bool types - code assumes
zipfilter, etc returns list type (they return iterators in py3)
Provided plex has been attempting to deprecate plugins support (like in this announcement for shield), I think it may not worth the effort migrating to python3 until the future of plugins support is clear.
Reacted by Benjamin Brisson and Josh Rusch- the usage of
I've spent the last two days investigating an issue where my files with Chinese characters or [] in the path were being incorrectly identified as
50X.After using git bisect, I've tracked the problem down to this specific commit. It appears that since the Plex binary relies on its own embedded Python 2.7, this change has broken support for all non-ASCII file paths.
Given the impact, I think this commit should be reverted as soon as possible.
Reacted by Benjamin BrissonI have crated #517.
Reacted by Benjamin Brisson
The latest ASS does not work correctly on python3.
Platform
Operating system and version: Ubuntu 22.04 (jammy)
Plex version: 1.41.3.9314-a0bfb8370
Expected Behavior
After installing in the correct directory with the correct permissions, I should be able to select ASS as the scanner and create a new library.
Current Behavior
After installing into the correct directory with the correct permissions, plex is unable to use ASS as a scanner. It appears in the list, but I see the error message
Your changes were not saved.upon trying to save the library.Steps to Reproduce
/var/lib/plexmediaserver/Library/Application\ Support/Plex\ Media\ Server/Scanners/Series/Absolute\ Series\ Scanner.pyAdditional information
The problem is that the current ASS does not compile with python3. This is easily verifiable:
To fix, replace regex strings starting with
ur'withr'. Theurprefix is not allowed in python3 althoughuandrby themselves are ok. Once I did this in my local copy, ASS works as expected.