Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[windows] Can't use LogViewer - 500 error, possible encoding issue #190

Closed
byg0n3 opened this issue Jul 14, 2016 · 20 comments
Closed

[windows] Can't use LogViewer - 500 error, possible encoding issue #190

byg0n3 opened this issue Jul 14, 2016 · 20 comments
Assignees
Milestone

Comments

@byg0n3
Copy link

byg0n3 commented Jul 14, 2016

Sad to come back here today again, but it seems that my problems doesn't end after #189.
Theme manager and UAS looks fine for now, but can't use LogViewer.
OS: Windows 10 x64
System-Wide language: Russian
Codepage: 1251
Locale: 1251

k9spqcm 1

2016-07-14 17:11:27,227 (600) :  DEBUG (logkit:13) - Fatal error happened in Logs show: 'utf8' codec can't decode byte 0xce in position 94: invalid continuation byte

Code reference:
Contents.Code.logs.logs#show:123

Worth to mention, that it works fine on my virtualbox with Linux Mint 18 and utf-8 by default.

wt_log_logviewer_error.zip

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

You are not the only one sorry here ;-)

Could I get a zip of the Plex Media Server.log please

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Sure.
pms_log.zip

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Guess, that lines like this can be the reason.

Jul 14, 2016 17:32:18.524 [3808] DEBUG - NetworkInterface: ignoring adapter 'Подключение по локальной сети* 2' 

Can't imagine, that I'm the only one, who facing such encoding problems with plex.
But found almost nothing usefull on the official forum. Feels bad :|

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

^^ Think so as well regarding the line.
And when trying your file on my box, it claims the file can't be found....
Puzzled here, so might take a while

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

logs.py file

Do an import like:
import codecs, locale

Then find line:

            with codecs.open(file, encoding=locale.getpreferredencoding(), errors='ignore') as content_file:
#           with io.open(file, 'rb') as content_file:

Then please report back

@ukdtom ukdtom added this to the V2.3 milestone Jul 14, 2016
@ukdtom ukdtom self-assigned this Jul 14, 2016
@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Still 500, but now with another reason
Fatal error happened in Logs show: builtins_open() takes at most 2 arguments (3 given)

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

Care to try the early alpha of the next version instead?
https://github.com/dagalufh/WebTools.bundle/archive/tommy-work.zip
And FindMedia is not yet working on the Windows platform, but should work on Linux

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Sure, why not.
Anyway I'm too nervous today for writing own code :D

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

LOL

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

And do report back regarding the logviewer

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

On alpha also same 500 as in previous comment

2016-07-14 19:13:15,194 (20b4) :  CRITICAL (core:574) - Fatal error happened in Logs show: builtins_open() takes at most 2 arguments (3 given) (most recent call last):
  File "C:\Users\dein0s\AppData\Local\Plex Media Server\Plug-ins\WebTools.bundle\Contents\Code\logs.py", line 139, in show
    with codecs.open(file, encoding=locale.getpreferredencoding(), errors='ignore') as content_file:
  File "C:\Program Files (x86)\Plex\Plex Media Server\python27.zip\codecs.py", line 881, in open
    file = __builtin__.open(filename, mode, buffering)
TypeError: builtins_open() takes at most 2 arguments (3 given)

alpha_pms_wt_logs.zip

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

God damn, why they just can't provide full version of current 2.7.x python? Will take another ~50 mb uncompressed, but will solve so much problems.

I remember that day, when I tried to get type of some variable. I was like O_O, wtf?
And few minutes later, when I just gave up, it was looking like

if isinstance(a, dict):
    print 'HOORAY'

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

Try this in the log.py file:

#           with codecs.open(file, encoding=locale.getpreferredencoding(), errors='ignore') as content_file:
            with io.open(file, 'r+', errors='ignore') as content_file:

And believe it or not, but codec.open behaves differently in Plex on Windows compared to Linux..:SIGH....

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

And has to stop for a while......Dinner time ;-)

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Take your time, I'm not in a hurry :)
And, for sure, I belive you. Happened to me also few times.

I'm getting permission restriction even when running PMS as admin with :

with io.open(file, 'r+', errors='ignore') as content_file:

Log:

2016-07-14 19:46:33,762 (1c68) :  CRITICAL (core:574) - Fatal error happened in Logs show: [Errno 13] Permission denied: u'C:\\Users\\dein0s\\AppData\\Local\\Plex Media Server\\Logs\\Plex Media Server.log' (most recent call last):
  File "C:\Users\dein0s\AppData\Local\Plex Media Server\Plug-ins\WebTools.bundle\Contents\Code\logs.py", line 138, in show
    with io.open(file, 'r+', errors='ignore') as content_file:
IOError: [Errno 13] Permission denied: u'C:\\Users\\dein0s\\AppData\\Local\\Plex Media Server\\Logs\\Plex Media Server.log'

@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

I made an error here....SIGH.....

In the line with io.open, change 'r+' into 'r'

Then please report back

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

Yep, you are right. Figured it ouy few mins ago.
Also, take a look Contents.Code.logs.logs#download:134. As I see, it needs same changes here.

ukdtom added a commit that referenced this issue Jul 14, 2016
@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

Indeed, and fixed with 39c1d17

@ukdtom ukdtom closed this as completed Jul 14, 2016
@ukdtom
Copy link
Owner

ukdtom commented Jul 14, 2016

And now wondering......Got any sidecar subs, in russian, that perhaps also breaks, when viewing in the subtitle module?

@byg0n3
Copy link
Author

byg0n3 commented Jul 14, 2016

On a first glance - nope.
But, to be honest, not yet tried to go in deeps of it, because mostly using plex for watching tv shows on-line (from russian portal) and twitch.tv (their native app for android tv sux a lot).
Aimed mostly for LV in WT under windows, because I'm too lazy to load vb everytime for debugging if I'm not in dev mode :D

But, for sure, will take a look at subs and findmedia in a free time.

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

No branches or pull requests

2 participants