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

'str' does not support the buffer interface on gh feed #84

Closed
surajssd opened this issue Oct 24, 2016 · 7 comments
Closed

'str' does not support the buffer interface on gh feed #84

surajssd opened this issue Oct 24, 2016 · 7 comments

Comments

@surajssd
Copy link

I get following error:

$ gh feed
Listing events...
Traceback (most recent call last):
  File "/usr/bin/gh", line 9, in <module>
    load_entry_point('gitsome==0.6.0', 'console_scripts', 'gh')()
  File "/usr/lib/python3.4/site-packages/gitsome/main_cli.py", line 26, in cli
    github.cli()
  File "/usr/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/githubcli.py", line 226, in feed
    github.feed(user_or_repo, private, pager)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 86, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 305, in feed
    items = self.trend_parser.parse(self.config.user_feed)
  File "/usr/lib/python3.4/site-packages/feedparser.py", line 3957, in parse
    saxparser.parse(source)
  File "/usr/lib64/python3.4/site-packages/drv_libxml2.py", line 189, in parse
    eltName = (_d(reader.NamespaceUri()),\
  File "/usr/lib64/python3.4/site-packages/drv_libxml2.py", line 70, in _d
    return _decoder(s)[0]
  File "/usr/lib64/python3.4/encodings/utf_8.py", line 16, in decode
    return codecs.utf_8_decode(input, errors, True)
TypeError: 'str' does not support the buffer interface

version: gitsome-0.6.0 installed using pip3

system config:

$ uname -a
Linux foo 4.7.6-100.fc23.x86_64 #1 SMP Mon Oct 3 18:15:29 UTC 2016 x86_64 x86_64 x86_64 GNU/Linux
@surajssd
Copy link
Author

Also:

$ gh feed surajssd -p
Listing events...
Traceback (most recent call last):
  File "/usr/bin/gh", line 9, in <module>
    load_entry_point('gitsome==0.6.0', 'console_scripts', 'gh')()
  File "/usr/lib/python3.4/site-packages/gitsome/main_cli.py", line 26, in cli
    github.cli()
  File "/usr/lib/python3.4/site-packages/click/core.py", line 716, in __call__
    return self.main(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 696, in main
    rv = self.invoke(ctx)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 1060, in invoke
    return _process_result(sub_ctx.command.invoke(sub_ctx))
  File "/usr/lib/python3.4/site-packages/click/core.py", line 889, in invoke
    return ctx.invoke(self.callback, **ctx.params)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/click/decorators.py", line 64, in new_func
    return ctx.invoke(f, obj, *args[1:], **kwargs)
  File "/usr/lib/python3.4/site-packages/click/core.py", line 534, in invoke
    return callback(*args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/githubcli.py", line 226, in feed
    github.feed(user_or_repo, private, pager)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 86, in auth_wrapper
    return func(self, *args, **kwargs)
  File "/usr/lib/python3.4/site-packages/gitsome/github.py", line 323, in feed
    build_urls=False)
  File "/usr/lib/python3.4/site-packages/gitsome/table.py", line 128, in build_table_setup
    build_urls)
  File "/usr/lib/python3.4/site-packages/gitsome/table.py", line 69, in build_table
    output += format_method(view_entry) + '\n'
  File "/usr/lib/python3.4/site-packages/gitsome/formatter.py", line 358, in format_event
    item += self.event_handlers[event.type](event)
  File "/usr/lib/python3.4/site-packages/gitsome/formatter.py", line 202, in _format_create_delete_event
    event.payload['description'])
  File "/usr/lib/python3.4/site-packages/gitsome/formatter.py", line 135, in _format_indented_message
    message = self.strip_line_breaks(message)
  File "/usr/lib/python3.4/site-packages/gitsome/formatter.py", line 643, in strip_line_breaks
    text = re.sub(r'\r', '', text)
  File "/usr/lib64/python3.4/re.py", line 179, in sub
    return _compile(pattern, flags).sub(repl, string, count)
TypeError: expected string or buffer

@donnemartin
Copy link
Owner

Hi @surajssd, thanks for the bug report. I am able to reproduce this issue running:

$ gh feed surajssd -p

Curious if you see a problem running the following command, which works for me:

$ gh feed donnemartin -p

@surajssd
Copy link
Author

@donnemartin

$ gh feed donnemartin -p

worked perfectly fine!

@SanketDG
Copy link
Contributor

SanketDG commented Oct 31, 2016

I looked into this, and this is happens because the description of the repo is passed as None to the json, which when parsed, obviously throws exceptions.

I have opened a simple fix at #89

I am not sure if @surajssd's gh feed command works, as it follows a different execution stack from what I see.

@surajssd
Copy link
Author

@SanketDG do you know why it's a special case with my username and also with my friend's username but works with @donnemartin 's username! :-|

@SanketDG
Copy link
Contributor

do you know why it's a special case with my username and also with my friend's username

I don't know about your friend but for your case https://github.com/surajssd/flaskapp-registration has no description. Lots of repos dont have descriptions, so this issue should have surfaced a long time ago. I might have to dig in deeper to find out the real problem.

@donnemartin
Copy link
Owner

Fixed in #89.

Lots of repos dont have descriptions, so this issue should have surfaced a long time ago. I might have to dig in deeper to find out the real problem.

See #89 (comment).

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

No branches or pull requests

3 participants