Skip to content

Unable to find Libraries after using PlexApi based python script. #1333

@amanjosan2008

Description

@amanjosan2008

Describe the Bug

The Libraries disappear from Plex WebUI and Apps everytime I use a PlexApi script. However I dont see any errors in Plex service or logs. The Libraries appear after I restart the Plex Service, which is a bit tedious to do every time.

Ths issue specifically come after runng the "switchUser" class from PlexServer:
userPlex = plex.switchUser("Normal User")

rn_image_picker_lib_temp_362c1155-56af-4c0d-b9b5-dbb3968b579d

Code Snippets

from plexapi.server import PlexServer

baseurl = 'http://192.168.1.1:32400'
token = 'xxxxxxxxxxxxxx'
plex = PlexServer(baseurl, token)
userPlex = plex.switchUser("MyUser")


library = ['My Movies','Tv Shows']

for lib in library:
    print(lib,'\n')
    movies = userPlex.library.section(lib)
    for video in movies.search(userRating=1):
        print("Deleting: ", video.title, "Rating: ", video.userRating)
        print(video.locations)
        #video.delete

Expected Behavior

Plex Libraries should not disappear after running plexapi's switchuser function.

Additional Context

No response

Operating System and Version

Raspbian GNU/Linux 11 (bullseye) Kernel 6.1.47-v8+ aarch64 GNU/Linux

Plex Media Server Version

Version 4.116.1

Python Version

Python 3.9.2

PlexAPI Version

4.15.7

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions