python-plexapi: xml.etree.ElementTree.ParseError: no element found: line 1, column 54

Hi,

i installed this plugin on my PMS server: https://github.com/d8ahazard/Cast.bundle when i play something with code below, it actualy plays, but i always receice this error below

what could be the cause?

film = plex.library.section('Movies').get('Terminator Genisys')
client = plex.client("TV Samsung")
client.playMedia(film)

Traceback (most recent call last):
  File "D:/Documents/Downloads/Pyhton/project1/plex.py", line 11, in <module>
    client.playMedia(film)
  File "D:\Documents\Downloads\Pyhton\project1\venv\lib\site-packages\plexapi\client.py", line 486, in playMedia
    }, **params))
  File "D:\Documents\Downloads\Pyhton\project1\venv\lib\site-packages\plexapi\client.py", line 204, in sendCommand
    return query(key, headers=headers)
  File "D:\Documents\Downloads\Pyhton\project1\venv\lib\site-packages\plexapi\client.py", line 168, in query
    return ElementTree.fromstring(data) if data.strip() else None
  File "C:\Users\fabio.pergola\AppData\Local\Programs\Python\Python37\lib\xml\etree\ElementTree.py", line 1316, in XML
    return parser.close()
xml.etree.ElementTree.ParseError: no element found: line 1, column 54

About this issue

  • Original URL
  • State: closed
  • Created 4 years ago
  • Comments: 31

Most upvoted comments

@blacktwin there’s already a check for this error for specific clients in the sendCommand() client call: https://github.com/pkkid/python-plexapi/blob/c0f2c056270b4456307333a9a3efcc8611034912/plexapi/client.py#L203-L213

Most of those clients return something like b'OK' which is not valid XML. The Samsung player returns some other value (which may just be the ‘Bad Request’ HTML response) but it’s probably best to confirm what that data is first.