So, a small amount of investigation shows that if I add any of the following 3 shows to my library in Plex then I get the error above…
All directories contain files in .avi, .mkv and .srt format
C:\InstalledPrograms\PlexEmail\scripts>Tree I:\Temp /F Folder PATH listing for volume DrivePool Volume serial number is 0016-710E I:\TEMP ├───Jane the Virgin │ ├───Season 01 │ └───Season 02 │ ├───Made in Chelsea │ └───Season 11 │ └───No Such Thing as the News └───Season 01
Remove the offending shows and the script runs with no issues.