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

UnicodeDecodeError: 'ascii' codec can't decode byte #170

Closed
3 of 9 tasks
tolik89u opened this issue May 19, 2017 · 14 comments
Closed
3 of 9 tasks

UnicodeDecodeError: 'ascii' codec can't decode byte #170

tolik89u opened this issue May 19, 2017 · 14 comments

Comments

@tolik89u
Copy link

tolik89u commented May 19, 2017

Please follow the guide below

  • You will be asked some questions and requested to provide some information, please read them carefully and answer honestly
  • Put an x into all the boxes [ ] relevant to your issue (like that [x])
  • Use Preview tab to see how your issue will actually look like

WARNING

All the invalid issues will be rejected!!


Before going further

  • If your problem is a bug with the youtube-dl program or a request for new site support please report it here

  • Make sure you are using the latest youtube-dl-gui version: Options > About tab. If it's not please download & install the latest version for your OS and check if your issue still persists

  • Make sure you are using the latest youtube-dl version: Click the Update button on the main screen and check if your issue still persists

  • Make sure you searched the bugtracker for similar issues including closed ones

    • I assure that my problem is NOT with youtube-dl
      how can I know, if it is youtube-dl, or it's youtube-dl-gui problem?
      Probably, yes, that's not youtube-dl problem 'cause I haven't even seen the GUI window and haven't press Download button.
    • I've verified and I assure that I'm running youtube-dl-gui 0.3.8
    • I assure that i am using the latest version of youtube-dl
      I've just installed youtube-dl-gui from https://mrs0m30n3.github.io/youtube-dl-gui/
      How can I know, which verstion of youtube-dl I use?
      Probably, yes, the latest version of youtube-dl-gui probably should use the latest version of youtube-dl, shouldn't it?
    • Searched bugtracker
      the similar issue is marked as solved
      Unicode decode error #57
      but my problem sure is not solved!

What is the purpose of your issue?

  • Bug during the download process (encountered problems after hitting the Download button)
  • Feature request (request for a new functionality)
  • Bug other (encountered other problems with youtube-dl-gui)
  • Question
  • Other

Please remove the following section between the (---) if your problem does not belong to the first two categories (bug report)

What operating system do you use ?

Windows 7 x64 SP 1, russian locale

List of actions to perform to reproduce the problem:

  1. start youtube-dl-gui (I've just installed it and it doesn't work)
  2. ..
  3. ..

What is the expected behaviour ?

the gui window opens

What happens instead ?

window opens and says «see the log file for details», and OK button. Nothing else, no GUI. After hitting OK, the window closes and that's all.


Description of your issue, suggested solution and other information. Please make sure the description is worded well enough to be understood.

the log file states:
Traceback (most recent call last):
File "youtube-dl-gui", line 35, in
File "youtube_dl_gui_init_.pyc", line 52, in
File "youtube_dl_gui\utils.pyc", line 94, in get_config_path
File "ntpath.pyc", line 84, in join
UnicodeDecodeError: 'ascii' codec can't decode byte 0xd2 in position 7: ordinal not in range(128)
I've installed
Python 2.7.3+
wxPython 3
followed by links from here https://mrs0m30n3.github.io/youtube-dl-gui/ but that didn't help.

@mikiqex
Copy link

mikiqex commented May 28, 2017

I encountered this problem as well, on a Win10 in Czech locale. On my Win10 in English locale it works fine.

@tolik89u
Copy link
Author

tolik89u commented May 28, 2017

In my computer, it is russial locale. (I think, it is worth mentioning here.)
I've updated the initial post and added this info.

@nodiscc
Copy link
Collaborator

nodiscc commented May 28, 2017

@mikiqex @tolik89u does your windows user account name have non-ASCII characters in it? (accentuated characters, Cyrillic characters?)

It would make sense since youtube-dl-gui tries to access %APPDATA% for the current user to store files.

@MrS0m30n3 maybe using config_path = convert_on_bounds(get_config_path()) here would be enough? Or is the error in utils.py#L165 ?

@tolik89u
Copy link
Author

tolik89u commented May 28, 2017

I don't know where in the code the error is, but yes, my username is Толик, i. e. consists of cyrillic characters.

BTW, YouTube-DLG is not the only program that had such an issue. I remember, in university I also had to install some programs from the user account that I've created espesially for that purpose and who's login doesn't contain cyrillic — because those programs couldn't install in Толик user account and displayed error.

It is interesting: when the problem with cyrillic login will be fixed, will the program work correctly, or it will throw an error — this time because of cyrillic file paths? :D

@nodiscc
Copy link
Collaborator

nodiscc commented May 28, 2017

@tolik89u proper unicode handling is a pain in python2, so that other program may have been python2 too :).

Your login name is used in your personal directory path C:\Users\Толик\, it has unicode characters and youtube-dl-gui expects a path of type string, not unicode to access the configuration directory (get_config_path()). There are already a few helper functions like convert_on_bounds() to convert unicode to strings but it seems the particular function get_config_path() does not make use of them, which is the cause of your error.

when the problem with cyrillic login will be fixed, will the program work correctly, or it will throw an error — this time because of cyrillic file paths

The problem here is all about unicode file paths, in this case the unicode part is your username.

But once it is fixed it would be interesting to know if saving a file in, for example C:\Users\Толик\загрузок\works.

By the way I looked in the master branch and not in new_layout which is the code for 0.3.8, so the code I pointed to may be wrong. @MrS0m30n3 ok to change the project's default branch to new_layout? It's in the github repo settings. That should prevent confusion :)

@tolik89u
Copy link
Author

tolik89u commented May 28, 2017

But once it is fixed it would be interesting to know if saving a file in, for example C:\Users\Толик\загрузок\works.

In fact, Windows substitutes standard directories names. Special Windows user directories have two names: one name is the real folder name, which is used by filesystem, such as Downloads or Pictures. The other is the displayed name, which is displayed in Explorer windows. It is somehow stored in destkop.ini file inside given special folder. Therefore, by default the Downloads folder in russian Windows is
C:\Users\Толик\Downloads
but in Explorer and standard system «file open/close» dialog windows this path is displayed as
C:\Пользователи\Толик\Загрузки
Path is displayed as Пользователи ... Загрузки, but in filesystem it is Users ... Downloads.
Therefore, with such standard path there will be no problems except for the username.
But anyway, user can change standard location in the Properties dialog on that folder, and user can move it for example to
D:\Загрузки
Also, anyone still can save file not to special system folder but to any other folder containing cyrillic, e. g.
C:\Users\Толик\Downloads\Some cyrillic folder name Кириллица\
Or even:
D:\Any other cyrillic path Кириллица\my file with cyrillic кириллица.mp4
Thus, this is still the case, but not with special system directories like Downloads by default, but for any other paths containing cyrillic (or other non-ASCII).

@MrS0m30n3
Copy link
Owner

MrS0m30n3 commented May 29, 2017

I dont have the time to read every bullshit everyone writes if you dont like the program dont use it end of story. I wont spend my time reading an issue when you cant take 5 minutes to file a proper report.
Also note that this error occurs due to the Python 2 mess with unicode and because Windows is crap.

P.S.
You run an old version and yes we know the download links are out of date.

Repository owner locked and limited conversation to collaborators May 29, 2017
Repository owner unlocked this conversation May 29, 2017
@tolik89u
Copy link
Author

tolik89u commented May 29, 2017

@MrS0m30n3, (or at least someone else, could you please help me? (in case if the author doesn't have much time for my "bullshit"))

  1. I did my best to file an issue "properly", I did "read carefully and answer honestly" every question in that checklist when filing the issue. What else I can do to make my report "proper"? I'd be glad to fix my report now, but if I only knew how exactly!
  2. If the program version on official site is outdated, then how can I get the current version? Should I somehow build binaries from .py to .exe by myself? Or this just means that Windows users are "outdated" as well?

@tolik89u
Copy link
Author

tolik89u commented May 29, 2017

You run an old version

I just found that current version is 0.3.8:
https://github.com/MrS0m30n3/youtube-dl-gui/blob/master/youtube_dl_gui/version.py
-- and I ran 0.3.8, as I mentioned in first post: youtube-dl-gui-0.3.8-win-*.zip -- so how can it be that I ran an old version? I don't understand!

@nodiscc
Copy link
Collaborator

nodiscc commented May 29, 2017

@MrS0m30n3 I think this bug report was filed correctly. To summarize:

youtube-dl-gui 0.3.8 crashes on launch when the user's home directory contains non-ascii characters.

Edit: indeed this seems to be a windows-specific problem. Linux (Debian) does not even let me create an user with such an username:

$ sudo adduser Толик
[sudo] password for user: ******
adduser: To avoid problems, the username should consist only of
letters, digits, underscores, periods, at signs and dashes, and not start with
a dash (as defined by IEEE Std 1003.1-2001). For compatibility with Samba
machine accounts $ is also supported at the end of the username
$

@tolik89u a workaround would be creating a user account without cyrillic characters. It will spare you many bugs in other programs, and I understand @MrS0m30n3 is not inclined to fix a windows-specific and rare bug since he doesn't use that operating system.

Closing as wontfix then

@tolik89u
Copy link
Author

tolik89u commented May 29, 2017

FYI, I just tried to run it from non-ASCII login -- it works fine. Moreover, it even correctly handles cyrillic file paths: both "save path" specified in options and the filename itself when title contains cyrillic chars and filename template contains %(title). Though there's still error message in log:

ERROR: unable to create directory [WinError 183] Íåâîçìîæíî ñîçäàòü ôàéë, òàê êàê îí óæå ñóùåñòâóåò: 'D:\Òîëèê\Óäàëèòü\Youtube-DLG'

but it downloads files correctly -- therefore I don't care about the error.

if you dont like the program dont use it end of story

BTW, @MrS0m30n3 , why do you think I don't like it? As I wrote above, only now I finally managed to make it not to crash immediately after start, and I was lucky to see it working. And only now I can decide whether I like it or not. And I definitely do like it! Thank you and all contributors to this program for your time spending on creating it!

I definitely will use it because I know no other alternatives to download from 1tv.ru list of multiple files at a time (earlier I had to download files manually one by one, it took a couple of minutes to start the download job manually for 10 -- 20 files). I'll run it under my surrogate non-cyrillic login -- thank you to @nodiscc for your tip!

@MrS0m30n3
Copy link
Owner

MrS0m30n3 commented May 30, 2017

See i'm a magician, download this and i am sure it will work with the weird username, if yes i dont get why @nodiscc marked this as wontfix since its clearly a duplicate. @tolik89u i love how you found issue #57 but you probably did not took the time to read through the issue.

If the above download does not work you can blame me 100% but i'm sure it will work.

@MrS0m30n3 MrS0m30n3 reopened this May 30, 2017
@MrS0m30n3
Copy link
Owner

@tolik89u wrote

I assure that i am using the latest version of youtube-dl
I've just installed youtube-dl-gui from https://mrs0m30n3.github.io/youtube-dl-gui/
How can I know, which verstion of youtube-dl I use?
Probably, yes, the latest version of youtube-dl-gui probably should use the latest version of youtube-dl, shouldn't it?

I think it's mentioned clearly in the issue template

Make sure you are using the latest youtube-dl version: Click the Update button on the main screen and check if your issue still persists

So no this report is still invalid and thats not the only reason...

@tolik89u
Copy link
Author

Now I see that. Yes, for some reason I thought that issue marked as closed is already implemented in current version, but now I see that it isn't — that's why I didn't read the issue to the end. Yes, the file you gave works fine with non-ASCII chars in login. Thank you, now I even don't have to "runas" it as ASCII login! I just run it from my account. Cool!

I still don't get how I could know which version of youtube-dl is used by my version of youtube-dlg if youtube-dlg crashed at start.

I've clicked "Update" button yesterday when I ran youtube-dlg as ASCII login, but this didn't solve the crash. Only your patch from #57 did. Again, thanks a lot for your help and 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

4 participants