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

Kivy app import effects Rpc #4539

Closed
timeyyy opened this issue Aug 17, 2016 · 10 comments
Closed

Kivy app import effects Rpc #4539

timeyyy opened this issue Aug 17, 2016 · 10 comments

Comments

@timeyyy
Copy link

timeyyy commented Aug 17, 2016

Background

neovim is a hackers vim with a nice community. They have seperated the ui and gui and expose the communication via rpc. I want to make a kivy interface for vim so i can have a vim text editor widget for kivy.

The Bug

The following code runs fine if we comment the line with kivy in it

from kivy.app import App # commenting this lets us spin up a neovim proceess and communicate with it
from distutils.spawn import find_executable
from neovim import attach

nvim_binary = find_executable('nvim')
args = [nvim_binary, '--embed']
nvim = attach('child', argv=args) # this call doesn't work properly with our kivy import..

With the import kivy line, the last line blocks. It's trying to do an rpc call.

@Zen-CODE
Copy link
Member

Personally, I don't think this could really be called a bug yet. Kivy is self contained and cannot provide support for external tools that do their own thing. Not that we don't want to get it working, just that we cannot provide support for every library. The code above in no way demonstrates kivy is doing anything wrong.

I would suggest posting on the forums and seeing if anyone can give you insight there, although without an error log, there is not much to go on...

@timeyyy
Please close if you agree, or comment otherwise.

@timeyyy
Copy link
Author

timeyyy commented Aug 17, 2016

All i'm saying is something weird is going on... I will keep digging into this, i will also be working with the neovim devs. Can i leave this open as a place to post further updates and get feedback?

I can also close this and post in the forum if that is more common practice here.

@timeyyy timeyyy closed this as completed Aug 17, 2016
@Zen-CODE
Copy link
Member

Sure. You can still post here on your findings and then re-open it if you find it is a flaw in kivy...

Thanks for taking the time. I hope it works out 👍

@Zen-CODE
Copy link
Member

Oh, can I suggest trying the call on a Clock.schedule_once? Or running it on a separate thread?

@timeyyy
Copy link
Author

timeyyy commented Aug 18, 2016

That snippet i posted above is the whole file. Literally that one line import stops me being able to connect over rpc to neovim. I posted a traceback on the neovim issue above,

i think it could be that attching in child mode is using stdio which kivy is using somehow? I will try one of the other transport types

@timeyyy
Copy link
Author

timeyyy commented Aug 18, 2016

The behavior only happens when i am using the child method to connect

   _connect_child(argv): Use the argument vector `argv` to spawn an
          embedded Nvim that has it's stdin/stdout connected to the event loop.

i'm guessing it is because kivy is doing stuff with stdin/stdout

@bfredl
Copy link

bfredl commented Aug 18, 2016

No, attach('child') does not use the python stdio handles, from python point of view it is a newly created pair of pipes. You mean you can still connect to a existing nvim instance over a named pipe ( attach('socket', path=...) ) ?

@timeyyy
Copy link
Author

timeyyy commented Aug 18, 2016

i used attach('headless')
It worked, meaning that the call didn't block, like it is doing above (didn't actually test it further)

also attach('socket', ..) "works"

@Zen-CODE
Copy link
Member

Great. Thanks both for the follow ups...

@timeyyy
Copy link
Author

timeyyy commented Aug 18, 2016

for closure:

it appears neovim abuses sys.stderr.fileno() to get the stderr file number, which might not work because Kivy takes over sys.stderr.

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

3 participants