Python error when executing :shell or :term

294 views
Skip to first unread message

Chris Sutcliffe

unread,
Apr 1, 2020, 1:14:56 PM4/1/20
to vim_mac
Hi,

When I execute :shell or :term I get the following error:

Fatal Python error: config_get_locale_encoding: failed to get the locale encoding: nl_langinfo(CODESET) failed
Python runtime state: preinitialized

Any ideas how to correct this?

Thanks!

Chris Sutcliffe

unread,
Apr 1, 2020, 1:42:57 PM4/1/20
to vim_mac
Some additional information - it's related to the locale settings when run directly as an application due to the encoding (the ".UTF-8") not being present.  If I execute:

open /Applications/MacVim.app

it works fine because the locale settings are correct in a terminal.

Pinnacle Systems Group

unread,
Apr 1, 2020, 2:23:50 PM4/1/20
to vim...@googlegroups.com, ir0n...@gmail.com
Chris

First check this .....

PYTHONHOME=/usr/local/Cellar/python3/3.x.y/Frameworks/Python.framework/Versions/3.x
PYTHONPATH=$PYTHONHOME/bin


Then look at this URL



--
--
You received this message from the "vim_mac" maillist.
Do not top-post! Type your reply below the text you are replying to.
For more information, visit http://www.vim.org/maillist.php

---
You received this message because you are subscribed to the Google Groups "vim_mac" group.
To unsubscribe from this group and stop receiving emails from it, send an email to vim_mac+unsubscribe@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/vim_mac/db653481-3ccb-474f-b9ed-6c58d5f9956a%40googlegroups.com.

Chris Sutcliffe

unread,
Apr 1, 2020, 10:12:54 PM4/1/20
to vim_mac
Hi,


First check this .....

PYTHONHOME=/usr/local/Cellar/python3/3.x.y/Frameworks/Python.framework/Versions/3.x
PYTHONPATH=$PYTHONHOME/bin


Then look at this URL


I'm not sure if this is related.  Checking PYTHONHOME and PYTHONPATH, both are unset in my environment.  Additionally, as per my follow-up, it seems to be related to the encoding being stripped from the LC_* variables when MacVim is launched directly (as opposed to being opened from a terminal where the LC_* variable are set correctly).  I see terminal apps have the option to set text encoding, not sure if it's possible to configure that in MacVim.

Chris Sutcliffe

unread,
Apr 2, 2020, 1:26:06 PM4/2/20
to vim_mac
To close on this issue, I've found a workaround and identified the issue to the MacVim team:


Cheers!
Reply all
Reply to author
Forward
0 new messages