Skip to content
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

Tmux error is not well handled which throws TypeError: a bytes-like object is required, not 'str' #29

Closed
qinfeng opened this issue Apr 20, 2018 · 0 comments

Comments

@qinfeng
Copy link
Contributor

qinfeng commented Apr 20, 2018

Tmux error is not well handled which cause bridgy tmux session not open.

env:
macOS 10.13 + python3.6.5

bridgy config:

 tmux:
   layout:
       logger:
           - cmd: split-window -h
           - cmd: split-window -h
           - cmd: split-window -h
             run: tail -f /var/log/syslog
           - cmd: set-window-option synchronize-panes on

bridgy command:

bridgy ssh -tl logger core -I mysource

error:

Traceback (most recent call last):
  File "/Users/qinfeng/.local/share/virtualenvs/bridgy-5NqTP_ZY/bin/bridgy", line 11, in <module>
    load_entry_point('bridgy', 'console_scripts', 'bridgy')()
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/__main__.py", line 425, in main
    handler(args, config)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/utils.py", line 34, in wrapper
    func(*args,**kwargs)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/__main__.py", line 218, in ssh_handler
    tmux.run(config, commands, args['-w'], layout, args['-d'], args['-s'])
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 20, in run
    with TmuxSession(commands=commands, in_windows=in_windows, layout_cmds=layout_cmds, dry_run=dry_run, sync=sync) as tmux:
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 58, in __enter__
    self.tmux(*cmd)
  File "/Users/qinfeng/Projects/github/bridgy/bridgy/tmux.py", line 118, in tmux
    repr(std_err.strip("\n").replace("\n",', ')),
TypeError: a bytes-like object is required, not 'str'

It looks like std_err returned by python subprocess pipe is in bytes type which needs to be decoded to str obj

@qinfeng qinfeng mentioned this issue Apr 20, 2018
wagoodman pushed a commit that referenced this issue Apr 20, 2018
milk531 pushed a commit to milk531/bridgy that referenced this issue Oct 8, 2023
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

2 participants