Kodi Community Forum

Full Version: script-module-web-pdb: a web-based remote Python debugger for addon developers
You're currently viewing a stripped down version of our content. View the full version with proper formatting.
Pages: 1 2
I'm also using the plain web-pdb module for debugging my (non-Kodi) raspberry pi scripts. It's been incredibly helpful.

I have posted a link to it on the raspberry pi forum.
(2016-10-21, 11:18)Roman_V_M Wrote: [ -> ]Does anybody actually uses it except for el_Paraguayo and myself?Big Grin

Dear Roman,
thank you very much for your amazing addon.
To really thank you for your work and spread your idea, I realized the following youtube video: Python debug in Kody
Hoping you will appreciate it, do not hesitate to express your feeling about it.
Thanks a lot to give me a chance to learn python starting from debugging kodi addons.
Best,
Michele Lombardo - Italy
2 m.lombardo

That is very nice! Thank you very much. I thought of making a video myself but never got to it because of various personal stuff. With your permission, I'll add the link to your video to the 1-st post and to the Readme on GitHub.

I have one question, though, because I've never worked with a Mac computer and do not know how things are done there. Do you really need to install Python before installing Kodi on Mac? Usually, Kodi is shipped with its own CPython runtime, except for Linux platforms where indeed the system Python is used.
(2016-10-26, 12:16)Roman_V_M Wrote: [ -> ]2 m.lombardo

That is very nice! Thank you very much. I thought of making a video myself but never got to it because of various personal stuff. With your permission, I'll add the link to your video to the 1-st post and to the Readme on GitHub.

I have one question, though, because I've never worked with a Mac computer and do not know how things are done there. Do you really need to install Python before installing Kodi on Mac? Usually, Kodi is shipped with its own CPython runtime, except for Linux platforms where indeed the system Python is used.

Of course, yes, add the link to the video wherever you want. Let's spread the knowledge and let people learn debugging Python in Kodi.
Mac osx comes with python 2.7 and Kodi is shipped with its own CPython runtime. I suggest to install v. 2.7.12 just to update any osx python version, to get familiar with www.python.org which is plenty of documentation and a very first entry point to start dealing with Python; last, in this way instructions should be useful for windows and linux users with some differences (i.e paths).
Maybe I had to clarify that on the video.

Thank you Roman for your appreciation.

My next step is learning to setup Eclipse in OSX for debugging Python in Kodi (I'm still trying to get things working).
Best.
Michele
I am trying to use your addon in android and it is giving me the following error:

Code:
15:07:10.425 T:18446744072331996848   ERROR: Exception in thread Thread-1:
                                            Traceback (most recent call last):
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/threading.py", line 801, in __bootstrap_inner
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/threading.py", line 754, in run
                                              File "/storage/emulated/0/Android/data/org.xbmc.kodi/files/.kodi/addons/script.module.web-pdb/libs/web_pdb/web_console.py", line 118, in _run_server
                                                httpd = make_server(host, port, app, handler_class=SilentWSGIRequestHandler)
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/wsgiref/simple_server.py", line 151, in make_server
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/SocketServer.py", line 417, in __init__
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/wsgiref/simple_server.py", line 48, in server_bind
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/BaseHTTPServer.py", line 108, in server_bind
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/SocketServer.py", line 431, in server_bind
                                              File "/home/jenkins/workspace/Android-ARM/tools/depends/xbmc-depends/arm-linux-androideabi-android-21/lib/python2.7/socket.py", line 228, in meth
                                            error: [Errno 98] Address already in use

Any ideas of what might be happening?
2 xtract47

The most obvious reason is stated in the error message: something probably is holding the port used by Web-PDB (5555 by default). However, from the traceback I see that you do not run the debugger on Android as you say, but in Jenkins CI. I'm not familiar with Jenkins and cannot tell how Web-PDB works in such environment. I only tested it in real Kodi 16 and 17 on Windows and LibreELEC, not in Android emulators. I don't remember if I've tested Web-PDB on my Android tablet, but the code does not have anything platform-specific and should work with any CPython 2.6-2.7 runtime.
(2016-11-28, 16:37)Roman_V_M Wrote: [ -> ]2 xtract47

The most obvious reason is stated in the error message: something probably is holding the port used by Web-PDB (5555 by default). However, from the traceback I see that you do not run the debugger on Android as you say, but in Jenkins CI. I'm not familiar with Jenkins and cannot tell how Web-PDB works in such environment. I only tested it in real Kodi 16 and 17 on Windows and LibreELEC, not in Android emulators. I don't remember if I've tested Web-PDB on my Android tablet, but the code does not have anything platform-specific and should work with any CPython 2.6-2.7 runtime.

I am using kody 17 last beta on android. I bet there is a problem with the threading.py at least in android, as now that I have the add-on coded and I want to launch it automatically with the Callbacks add-on it yields the same error. Where/to whom should I report it to?

Thanks!
(2016-11-29, 18:02)xtract47 Wrote: [ -> ]
(2016-11-28, 16:37)Roman_V_M Wrote: [ -> ]2 xtract47

The most obvious reason is stated in the error message: something probably is holding the port used by Web-PDB (5555 by default). However, from the traceback I see that you do not run the debugger on Android as you say, but in Jenkins CI. I'm not familiar with Jenkins and cannot tell how Web-PDB works in such environment. I only tested it in real Kodi 16 and 17 on Windows and LibreELEC, not in Android emulators. I don't remember if I've tested Web-PDB on my Android tablet, but the code does not have anything platform-specific and should work with any CPython 2.6-2.7 runtime.

I am using kody 17 last beta on android. I bet there is a problem with the threading.py at least in android, as now that I have the add-on coded and I want to launch it automatically with the Callbacks add-on it yields the same error. Where/to whom should I report it to?

Thanks!

My Acer tablet old enough to run Kodi 17, but I doubt that threading module is the reason. Your exception traceback states the problem is with socket module being unable to open a network connection. Are you sure you don't have another service listening to 5555 port? You can try a different port, preferably from a higher range.
Otherwise, I'm afraid this problem is specific to your system is very hard or impossible to diagnose without access to your system.
I made a video tutorial for script-module-web-pdb debugger and added it to the 1st post of this topic. Your feedback is welcomed but please take into account that it is my very first attempt to make a tutorial video.
(2017-05-10, 23:12)Roman_V_M Wrote: [ -> ]I made a video tutorial for script-module-web-pdb debugger and added it to the 1st post of this topic. Your feedback is welcomed but please take into account that it is my very first attempt to make a tutorial video.

Dear @Roman_V_M,

yesterday, I found your video as well as Michele's introduction video while I was looking for guidelines to Kodi addon coding. Being new to Python and Kodi addons, I do greatly appreciate this because actually I was looking for a comfortable way of looking into what my code does during runtime.
So thanks a lot for providing the Web-PDB module and for explaining it in the video !
Of course also thanks to @m.lombardo.

Best Regards,
Kr1ss
Pages: 1 2