Skip to content

Pydocs (Shift + K) Not Working in Branch 6.4 #99

Closed

Description

@gmrichmond

I noticed that the Pydocs do not work in Branch 6.4. The result of pressing Shift+K is:

Error detected while processing function pymode#doc#Show:                                             
line    9:
Traceback (most recent call last):
File "<string>", line 1, in <module>
TypeError: bad argument type for built-in operation

However, using the python-mode / autoload / pymode / doc.vim from Branch 6.3 works correctly.

The following shows the differences between Branches 6.3 and 6.4...

Branch 6.3

fun! pymode#doc#Show(word) "{{{
if a:word == ''
echoerr "No name/symbol under cursor!"
else
py import StringIO
py sys.stdout, _ = StringIO.StringIO(), sys.stdout
py help(vim.eval('a:word'))
py sys.stdout, out = _, sys.stdout.getvalue()

        redi @">
        sil!py print out
        redo END

call pymode#TempBuffer()

        normal ""Pdd

wincmd p
endif
endfunction "}}}

Branch 6.4

fun! pymode#doc#Show(word) "{{{
if a:word == ''
echoerr "No name/symbol under cursor!"
else
py import StringIO
py sys.stdout, _ = StringIO.StringIO(), sys.stdout
py help(vim.eval('a:word'))
py sys.stdout, out = _, sys.stdout.getvalue()
call pymode#TempBuffer()

        py vim.current.buffer.append(out.split('\n'), 0)

wincmd p
endif
endfunction "}}}

Using the python-mode / autoload / pymode / doc.vim from Branch 6.3 appears to work correctly in Branch 6.4, but I do not know if there are any negative effects from this. I am using MacVim 7.3/Pathogen and tested it with Python 2.7 and 2.6. I have also confirmed the same behavior with Vim 7.2 on Amazon Linux.

A fix (or guidance if I am doing something wrong) would be appreciated.

Note: Thank you for building and maintaining this awesome plugin!

Activity

  1. alexrah commented on Aug 27, 2012

    @alexrah

    very same problem here still on 6.7.
    solved following your bug report, that is, changing doc.vim as it was in 6.3 version.
    I know this isn't a proper fix, as I get:

    Error detected while processing function pymode#doc#Show:

    but at least, it disappear soon and opens the docs anyway.

  2. gag commented on Dec 11, 2012

    @gag

    I solved this by changing

    py vim.current.buffer.append(out.split('\n'), 0)                  
    

    in doc.vim to

    py vim.current.buffer.append(str(out).split('\n'), 0)
    

    works perfectly fine now :)

  3. gmrichmond commented on Dec 12, 2012

    @gmrichmond
    Author

    Wonderful! Thanks so much!

    On Tue, Dec 11, 2012 at 6:28 AM, Gleb notifications@github.com wrote:

    I solved this by changing

    py vim.current.buffer.append(out.split('\n'), 0)

    in doc.vim to

    py vim.current.buffer.append(str(out).split('\n'), 0)

    works perfectly fine now :)

    —
    Reply to this email directly or view it on GitHubhttps://github.com//issues/99#issuecomment-11245276.

  4. added a commit that references this issue on Dec 15, 2012
  5. added a commit that references this issue on Mar 14, 2013
  6. added a commit that references this issue on Aug 16, 2013
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions