Skip to content

bug: fails to run when LANG=ja_JP.UTF-8 #11

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

Open
pysan3 opened this issue Mar 13, 2022 · 0 comments
Open

bug: fails to run when LANG=ja_JP.UTF-8 #11

pysan3 opened this issue Mar 13, 2022 · 0 comments

Comments

@pysan3
Copy link

pysan3 commented Mar 13, 2022

Hi @CrispyConductor,

Thanks for the awesome plugin :)

I bumped into a bug running this plugin when I set the default language of the shell to Japanese with LANG=ja_JP.UTF-8.

Traceback

$ python3 /home/user/.local/share/tmux/plugins/tmux-copy-toolkit/copytk.py easycopy --search-nkeys 1
Traceback (most recent call last):
  File "/home/user/.local/share/tmux/plugins/tmux-copy-toolkit/copytk.py", line 1356, in <module>
    run_wrapper(args.action, args)
  File "/home/user/.local/share/tmux/plugins/tmux-copy-toolkit/copytk.py", line 1293, in run_wrapper
    pane = get_pane_info(args.t)
  File "/home/user/.local/share/tmux/plugins/tmux-copy-toolkit/copytk.py", line 253, in get_pane_info
    r = runtmux(args, one=True).split(' ')
  File "/home/user/.local/share/tmux/plugins/tmux-copy-toolkit/copytk.py", line 88, in runtmux
    with subprocess.Popen(
  File "/home/user/.local/share/pyenv/versions/3.8.5/lib/python3.8/subprocess.py", line 854, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "/home/user/.local/share/pyenv/versions/3.8.5/lib/python3.8/subprocess.py", line 1702, in _execute_child
    raise child_exception_type(errno_num, err_msg, err_filename)
FileNotFoundError: [Errno 2] No such file or directory: '/usr/bin/tmux です'

The output of command -V command is different in the Japanese version.

$ LANG=ja_JP.UTF-8 command -V tmux
tmux は /usr/bin/tmux です
$ LANG=en_US.UTF-8 command -V tmux
tmux is /usr/bin/tmux

Possible Fix

Specifying LANG fixed the problem in my case.
However, I was not confident enough to send a PR whether this solution works on every environment...

  # copytk.py line 25
  def find_command_path(c):
-    cmd = 'command -V ' + c
+    cmd = 'LANG=en_US.UTF-8 command -V ' + c
     f = os.popen(cmd)

Hope this helps.

Best,
pysan3

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

No branches or pull requests

1 participant