polygamma / aurman

AUR Helper
MIT License
567 stars 35 forks source link

Python UnicodeEncodeError raised in aurman/utilities.py when searching with -Ss #77

Closed khalismur closed 6 years ago

khalismur commented 6 years ago

Description

When searching for a package with aurman -Ss, sometimes a python error is raised when outputing the description of some package.

Expected Behavior

Searches for and lists all packages, printing their description without any problems.

Current Behavior

Sometimes the aurman/utilities.py will fail to print a package description and package search is interrupted.

Possible Solution

Error handling in aurman/utilities.py

Steps to Reproduce

  1. aurman -Ss atom
  2. Lists without problems packages in extra/ and community/ repos. When it starts to check aur/ repo, the first package aur/quiterss fails to print the description. Python UnicodeEncodeError is raised.

Here is the partial output of aurman -Ss atom: ..... first dozen packages in extra/ and community/ ...

community/tt-rss 1:17.4.r441.ge35a4673-1                                                                            
    Web-based news feed (RSS/Atom) aggregator                                                                       
community/vim-seti 1.0-2 (vim-plugins)                                                                              
    Colorscheme based on Jesse Weed's Seti theme for the Atom editor                                                
aur/quiterss 0.18.10-1 (38, 4.283009)                                                                               
2018-04-24 09:03:46,500 - main - main - ERROR -                                                                     
Traceback (most recent call last):                                                                                  
  File "/usr/lib/python3.6/site-packages/aurman/main.py", line 526, in main                                         
    process(argv[1:])                                                                                               
  File "/usr/lib/python3.6/site-packages/aurman/main.py", line 225, in process                                      
    search_and_print(search, installed_system, str(pacman_args), repo, aur)                                         
  File "/usr/lib/python3.6/site-packages/aurman/utilities.py", line 92, in search_and_print                         
    print("    {}".format(ret_dict['Description']))                                                                 
UnicodeEncodeError: 'ascii' codec can't encode character '\u0421' in position 54: ordinal not in range(128)
polygamma commented 6 years ago

I am not able to reproduce that, do you use a special python version or something like that?

khalismur commented 6 years ago

Python 3.6.4 in Manjaro

polygamma commented 6 years ago

Sorry, Manjaro is unsupported.

polygamma commented 6 years ago

Addition: But nevertheless: Which terminal do you use?

khalismur commented 6 years ago

Have the same issue with Konsole 17.12.3, yakuake 3.0.5 and xterm 331.

Most of aur searches work fine though. Sometimes there's this encode problem though..

polygamma commented 6 years ago

Works with xterm for me, hence it is an issue on your side. Since you are using Manjaro, I am not going to investigate any further, sorry.

Edit: You may check the locale you chose, if it is a non utf-8 version.