Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs
#31
Hi there,

I find Kodistubs really-really helpful, however I think there are a couple of things missing, ex.:

Several items in Player class:
http://mirrors.kodi.tv/docs/python-docs/...tml#Player

EDIT: Sorry my mistake, didn't properly typed some command. Please ignore this message.
Reply
#32
That is amazing. Thank you so much.

One thing.

Im working with pyxbmct and the import is red. "Unresolved import: pyxbmct"

Maybe its my mistake, but is there someway I can add that to kodistubs too?
Reply
#33
(2016-11-19, 07:41)user5 Wrote: That is amazing. Thank you so much.

One thing.

Im working with pyxbmct and the import is red. "Unresolved import: pyxbmct"

Maybe its my mistake, but is there someway I can add that to kodistubs too?

pyxbmct is a separate library and has nothing to do with Kodistubs. Add pyxbmct to your project's Python dependencies the same way as you do this for Kodistubs.
Reply
#34
I just wanted to announce that I pushed to GitHub a totally re-worked version of Kodistubs. The stub files are now generated (indirectly) from Kodi sources so they re-create Kodi Python API as thoroughly as possible. Now Kodistubs also include PEP-484 type annotations that provide information about actual arguments/return values of Kodi Python API functions and methods. Some Python IDE/code editors (e.g. PyCharm) support such type annotations and warn you if you are trying to pass incompatible arguments to functions/methods.

If you previously installed Kodistubs using pip, run pip install --upgrade git+https://github.com/romanvm/Kodistubs.git#egg=Kodistubs to upgrade.
Reply
#35
Hi, is it possible to use Kodistubs with VS Code? I've created a virtual environment and installed them through pip but I can't get them to show up.
Reply
#36
@SpAiK Have you selected your virtual environment via VSCode command palette? 

BTW, Kodistubs 18 are almost ready .
Reply
#37
It seems to be working now as I've discovered that I actually was not into the venv because a Powershell run policy that was not executing the activate script.

Now I got all the stuff, although linter is still complaining about import xbmc and xbmcgui (not xbmcaddon):
Image
Reply
#38
@SpAiK You are not using a right version of Python. Currently Kodi provides Python 2.7 interpreter (and 18.x is planned to be the last version with Python 2) so Kodistubs use Python 2 syntax.

@ All

I'm please to announce that Kodistubs v.18.0.0 have been released. They include functions and classes from Kodi 18 "Leia" Python API, including the new xbmcdrm module for interacting with DRM (I don't even know how this works).

To upgrade Kodistubs in your working virtual environment simply run: pip install --upgrade Kodistubs.
Reply
#39
Hi,
Quick question
Has anyone mention a syntax error in xbmcgui?

I created a one line bob.py file

import xbmcgui

Ran pylint against it
pylint bob.py

************* Module bob
bob.py:4:0: E0001: Cannot import 'xbmcgui' due to syntax error 'invalid syntax (<unknown>, line 1090)' (syntax-error)
bob.py:4:0: W0611: Unused import xbmcgui (unused-import)

-----------------------------------------------------------------------
Your code has been rated at -50.00/10 (previous run: -16.67/10, -33.33)
Reply
#40
@dsime42 Quick question: have you read 2 posts just above yours?
Reply
#41
Ignore my post. :-)
I ran it in Python3 and the "0L" returned on line 1090 is no longer valid in Python3 should just be "0"
So it works when run under Python2
Reply
#42
I'm still working with krypton, 17.6. What version of kodistubs do I need to install for that code base?  THANKS!
Reply
#43
17.6 can still be installed with pip install or downloaded from respective tags on GitHub. But v. 17 is missing callback methods for xbmc.Player and xbmcgui.Window classes as a result of a bug in the generator script. It was fixed only in v. 18.
Reply
#44
Hi,

I am new to creating Kodi addon. Thanks @Roman_V_M , all your discussions/blogs have been super helpful with getting into addon creation. 

So far I have created Virtual environment and installed Kodistubs18, xbmcswift2 (using VS Code and Python 3.8). While trying to create a "Hello World" addon, I get the following error (same as @dsime42) : 

 import xbmcgui
    return 0L
            ^
SyntaxError: invalid syntax


I understand that switching to Python2 can help resolve this issue. However, as per this blog post, it looks like Python2 will not be supported in near future. So, is there a way for me to create addon in Python3 and not get this compatibility error?

This is my python code so far:
import xbmcgui
var = "hello world"
print(var)


I do not have an addon.xml yet and I am just trying to run this code from VS Code using python console for now, just to check if I can import xbmc libraries successfully (taking baby steps).
Reply
#45
(2019-12-25, 21:16)noobCreator Wrote: I do not have an addon.xml yet and I am just trying to run this code from VS Code using python console for now, just to check if I can import xbmc libraries successfully (taking baby steps).

Please carefully read Kodistubs description in the 1st post of this topic. Kodistubs are not meant to run your code outside Kodi unless you know exactly what you are doing. As for addon development in general, the current Kodi version supports Python 2 so the best way is to work in a Python 2 virtual environment and use helper libraries like six or future to ensure Python 2/3 compatibility.
Reply

Logout Mark Read Team Forum Stats Members Help
Kodistubs (xbmcstubs) - code auto-completion and quick help for Python IDEs2