Skip to content

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

@pysan3

Description

@pysan3

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions