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

jira-cli cannot work well with linux/Mac pipe o/p #75

Open
philips-ni opened this issue Aug 8, 2018 · 4 comments
Open

jira-cli cannot work well with linux/Mac pipe o/p #75

philips-ni opened this issue Aug 8, 2018 · 4 comments

Comments

@philips-ni
Copy link

This is a handy tool!
In Linux/Mac, we use " | grep " a lot to do the filter work.
But while I tried to use jira-cli to filter the result, I see this error.

➜ ~ jira-cli list projects|grep -i web
Traceback (most recent call last):
File "/usr/local/bin/jira-cli", line 11, in
load_entry_point('jira-cli==2.2', 'console_scripts', 'jira-cli')()
File "/usr/local/lib/python3.7/site-packages/jiracli/interface.py", line 272, in cli
return post_args.cmd(jira, post_args).execute()
File "/usr/local/lib/python3.7/site-packages/jiracli/processor.py", line 30, in execute
return self.eval()
File "/usr/local/lib/python3.7/site-packages/jiracli/processor.py", line 121, in eval
val += " [" + colorfunc(item['key'], 'magenta') + "]"
TypeError: can only concatenate str (not "bytes") to str
➜ ~

@kyrrigle
Copy link

This is a python3 problem I suspect. The encode here is returning a bytes that then cannot be concatenated with strings later-

color = True
if not sys.stdout.isatty():
    colorfunc = lambda *a,**k:str(a[0]).encode('utf-8')
    color = False

a "fix" for that in python3 is to just remove the .encode('utf-8') part

@atsalolikhin-spokeo
Copy link

I tried this on macOS 11 (Big Sur) and couldn't duplicate the issue.

jira-cli list projects|grep -i web

This works fine! No python errors.

I suspect this issue is stale and can be closed.

@justinabrahms
Copy link

I see this issue on v2.2 and (just upgraded) 3.0.

It also triggers with output redirection. (e.g. > not just |)

Using python v3.

@justinabrahms
Copy link

Heads up, that this fixes it. bridge/init.py line ~116

            ret_str = colorfunc(issue["key"], status_color).decode('utf-8') + " " + issue.setdefault("summary", "") + " " + url_str.decode('utf-8')

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

4 participants