You are not logged in.
Pages: 1
Since yesterday some of my python applications (ranger, py3status) no longer work and throw the error:
ranger version: 1.7.2, executed with python 3.5.1
Locale: None.None
Current file: None
Traceback (most recent call last):
File "/usr/lib/python3.5/site-packages/ranger/core/main.py", line 121, in main
fm.initialize()
File "/usr/lib/python3.5/site-packages/ranger/core/fm.py", line 118, in initialize
self.ui.initialize()
File "/usr/lib/python3.5/site-packages/ranger/gui/ui.py", line 82, in initialize
self.setup()
File "/usr/lib/python3.5/site-packages/ranger/gui/ui.py", line 242, in setup
self.console = Console(self.win)
File "/usr/lib/python3.5/site-packages/ranger/gui/widgets/console.py", line 44, in __init__
for line in f:
File "/usr/lib/python3.5/encodings/ascii.py", line 26, in decode
return codecs.ascii_decode(input, self.errors)[0]
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc2 in position 843: ordinal not in range(128)
ranger crashed. Please report this traceback at:
https://github.com/hut/ranger/issuesI don't now whether it was something I did (probably) or not. I have removed all packages installed since then and tried to revert all changes, but I can't put my finger on the exact source. I think something in my user settings is overwriting my locales because logging in as a different user in a tty console I can run ranger and lsblk without errors. Manually setting the LANG variable for ranger works, but it does nothing for lsblk.
Something that does work:
$ export LANG=en_US.UTF-8; rangerSurprisingly the output of lsblk in an XTerm terminal is okay, however in urxvt it looks like this:
/home/neutronst4r neutronst4r@Archy% lsblk
NAME MAJ:MIN RM SIZE RO TYPE MOUNTPOINT
sda 8:0 0 232.9G 0 disk
ââsda1 8:1 0 190M 0 part /boot
ââsda2 8:2 0 1K 0 part
ââsda5 8:5 0 9.3G 0 part
â ââswap 254:1 0 9.3G 0 crypt [SWAP]
ââsda6 8:6 0 223.4G 0 part
ââmain 254:0 0 223.4G 0 crypt /
sdb 8:16 0 1.4T 0 disk
ââsdb1 8:17 0 1K 0 part
ââsdb5 8:21 0 1.4T 0 part
ââhdd 254:2 0 1.4T 0 crypt /Storageranger on the other hand works in neither terminal.
Some more information. (I have no ~/.config/locale/locale.conf):
/home/neutronst4r neutronst4r@Archy% cat /etc/locale.conf
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8
/home/neutronst4r neutronst4r@Archy% cat /etc/environment
#
# This file is parsed by pam_env module
#
# Syntax: simple "KEY=VAL" pairs on separate lines
#en_US.UTF-8 is of course uncommented in locale.gen and gen-locale has been run successfully.
/home/neutronst4r neutronst4r@Archy% python
Python 3.5.1 (default, Mar 3 2016, 09:29:07)
[GCC 5.3.0] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.getdefaultencoding()
'utf-8'
>>> Last edited by neutronst4r (2016-03-24 16:29:38)
makepkg not war
Offline
/home/neutronst4r neutronst4r@Archy% localectl
System Locale: LANG=en_US.UTF-8
VC Keymap: de
X11 Layout: deI just tried "xterm -u8" and all programs work fine in this terminal, however regular shell commands in and out off urxvt still don't work. I did read the wiki, but I don't know what else there is I could try. These commands all don't work:
export LC_ALL=en_US.UTF-8; lsblkexport LC_ALL=en_US.UTF-8; py3status -c <config file>ranger does work however... by exporting LANG or LC_ALL first.
Last edited by neutronst4r (2016-03-24 08:50:07)
makepkg not war
Offline
Try
$ export LC_ALL=C; lsblkThe second program, I don't use it.
do it good first, it will be faster than do it twice the saint ![]()
Offline
Okay, I fixed it now by adding the following to by .zshrc.
LANG=en_US.UTF-8
LANGUAGE=en_US.UTF-8Somehow zsh, which is my default shell, does not respect the environment variable LANG set in /etc/locale.conf. Without the lines above, the output of "locale" looks like:
/home/neutronst4r neutronst4r@Archy% locale
LANG=
LC_CTYPE="POSIX"
LC_NUMERIC="POSIX"
LC_TIME="POSIX"
LC_COLLATE="POSIX"
LC_MONETARY="POSIX"
LC_MESSAGES="POSIX"
LC_PAPER="POSIX"
LC_NAME="POSIX"
LC_ADDRESS="POSIX"
LC_TELEPHONE="POSIX"
LC_MEASUREMENT="POSIX"
LC_IDENTIFICATION="POSIX"
LC_ALL=Thanks for the help.
Last edited by neutronst4r (2016-03-24 16:29:22)
makepkg not war
Offline
I appreciate that you have marked this thread as solved, but here are some things to check:
1. Have you modified /etc/zsh/zprofile? It should sourcing /etc/profile, if nothing else.
2. Have you modified /etc/profile? It should have a if-for block that tests and sources the .sh files in /etc/profile.d (which includes locale.sh)
3. Have you modified /etc/profile.d/locale.sh? By default, it should read and set the locale from $XDG_CONFIG_HOME/locale.conf, $HOME/.config/locale.conf, or /etc/locale.conf, depending on which files exist (and are readable).
4. If you have all of the above files, and have not modified them (or haven't altered them in a way that breaks the above functionality), check whether $XDG_CONFIG_HOME/locale.conf or $HOME/.config/locale.conf exist and if they do, make sure they correctly specify the locale you want.
5. If all the above checks out, check that all these files are readable by your user.
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
1. Have you modified /etc/zsh/zprofile? It should be sourcing /etc/profile, if nothing else.
Uhm that file didn't exist. I just removed zsh with "pacman -Rn" and reinstalled it, it created it with the following line:
emulate sh -c 'source /etc/profile'I suppose that was it, because now it works without the extra LANG variable lines. Thanks and sorry for wasting everyones time ![]()
makepkg not war
Offline
Yep, that'll have been it. Locale setting is a fickle beast. If you break a single link in that source chain, your locale won't get set correctly (without workarounds at least). You might want to find out why that file disappeared (check your command history), but if you've learnt how zsh sets your locale by reading through those files, then it's not a waste of time. ![]()
Sakura:-
Mobo: MSI MAG X570S TORPEDO MAX // Processor: AMD Ryzen 9 5950X @4.9GHz // GFX: AMD Radeon RX 5700 XT // RAM: 32GB (4x 8GB) Corsair DDR4 (@ 3000MHz) // Storage: 1x 3TB HDD, 6x 1TB SSD, 2x 120GB SSD, 1x 275GB M2 SSD
Making lemonade from lemons since 2015.
Offline
Pages: 1