I'm working migrating
DBMC with a solid understanding of python3 but python2 is still newer to me;
- Noob question here first, where do I obtain the libraries, like 'requests', for use in the lib directory?
- How should I be debugging this? I am currently trying to install/launch the plugin then looking at the logfile in kodi directory.
- Besides the syntax and module change what other hurdles will I likely run into?
Thank you for the info.
I think you are right about creating a new addon.
(2023-09-07, 09:42)dazemc Wrote: [ -> ]I'm working migrating DBMC with a solid understanding of python3 but python2 is still newer to me;
- Noob question here first, where do I obtain the libraries, like 'requests', for use in the lib directory?
- How should I be debugging this? I am currently trying to install/launch the plugin then looking at the logfile in kodi directory.
- Besides the syntax and module change what other hurdles will I likely run into?
I've migrated a few older addons from Kodi 18 and before to Kodi 19. Here's the basic steps I use:
1. Device if you are going to maintain a single addon which supports both Python 2 and 3 or have separate addons. I don't recommend the single addon approach except for the most basic addons
2. Use the Python 2to3 program on each PY file
3. Convert the settings file using the
Team Kodi provided tool
4. Eliminate deprecated calls that are no longer supported (i.e. xbmc.translatePath to xbmcvfs.translatePath etc..)
Don't worry about the last one too much. The Kodi logs will call these out for you to fix. I've converted around 6 addons so far, including maintaining a monster addon with Kodi 18 and 19+ versions. One area which can be a problem is if your addon has external dependencies that aren't part of the standard Kodi repo. I don't use those. Some common Python libraries have Kodi wrappers for them so you just need to call those in the addon.xml file as a dependency.
Thanks,
Jeff
I have used 2to3 on all py files, replaced the xbmc with xbmcvfs calls, switched from urllib3 to requests, and changed to xbmc.python 3.0.1.
I'm having issues with the setting script. It won't run on addons that are not installed. I'm missing dependencies on the local files that it's calling outside of the addon.xml
"from resources.lib.utils import *" are how they are brought in. I assume that this needs to be in the addon.xml now? I can't figure out how to add local file dependencies in the xml.
I put up a repo,
plugin_dbmc
(2023-09-11, 10:04)dazemc Wrote: [ -> ]I have used 2to3 on all py files, replaced the xbmc with xbmcvfs calls, switched from urllib3 to requests, and changed to xbmc.python 3.0.1.
I'm having issues with the setting script. It won't run on addons that are not installed. I'm missing dependencies on the local files that it's calling outside of the addon.xml
"from resources.lib.utils import *" are how they are brought in. I assume that this needs to be in the addon.xml now? I can't figure out how to add local file dependencies in the xml.
I put up a repo,
plugin_dbmc
You've added it manually in your
addon.xml file on line 7. This is per how @
jepsizofye instructed. This is a Kodi wrapper for requests to be pulled into the Python environment. You need to confirm that Kodi has loaded script.module.requests as an addon, which it should have. If Kodi has loaded it then it would be best to post the kodi.log error message you are getting. I am no a requests expert but we should be able to figure it out. I am old school and still using urllib but it is a lot more work and less flexible than requests.
Thanks,
Jeff
Yes I was able to figure out the how to add dependency in addon.xml.
I have gotten it installed without errors and I think I've gotten most of the py2 stuff out of the way.
I had to change some of the logging that was still using LOGNOTICE instead of LOGINFO, etc.
I'm now getting stuck on the dropbox API handling I believe.
I'm also getting an attribute error for 'abortRequested' on xbmc but I can't find anything about that being unsupported
Here is the log file;
logfile
(2023-09-12, 06:50)dazemc Wrote: [ -> ]I'm also getting an attribute error for 'abortRequested' on xbmc but I can't find anything about that being unsupported
https://forum.kodi.tv/showthread.php?tid=354975
Quote:Disabled debug logging due to GUI setting. Level 0.
enable debug logging for more verbose information -
Debug Log
(2023-09-12, 09:29)dazemc Wrote: [ -> ]Okay thank you no more attribute error
Here's updated logfile;
logfile with debug actually on
I can't see your code but this is a type error on the result passed to ord(). Just change it to ord(str(c1)) and ord(str(c2)) on line 68 of your utils.py file. I tried to post the code but keep getting blocked by Cloudflare.
Thanks,
Jeff
from an outside viewpoint it looks like it is not getting a response it expects to get from dropbox
need to find out what is being returned by the server and compare it to what should be returned
i suspect it has to do with an api change and now the old api isn't viable
(2023-09-12, 15:52)jepsizofye Wrote: [ -> ]from an outside viewpoint it looks like it is not getting a response it expects to get from dropbox
need to find out what is being returned by the server and compare it to what should be returned
i suspect it has to do with an api change and now the old api isn't viable
Yeah, that was my assumption too. My fix was quick and dirty to get the type mismatch fixed. Then troubleshoot he underlying cause. Don't have enough info to go much further.
Jeff
I'm almost positive that it's an API change. It looks like that ord() function is handling the authentication token. I can try to change to a string to get pass the errors but I will be looking at the API changes later today. I'll most likely end up just rewriting that entire portion of the code depending on the changes Dropbox has made. It looks like the are using 0auth 2.0 now.
Here let's try just the url for the code,
https://github.com/dazemc/plugin_dbmc
(2023-09-12, 20:41)dazemc Wrote: [ -> ]I'm almost positive that it's an API change. It looks like that ord() function is handling the authentication token. I can try to change to a string to get pass the errors but I will be looking at the API changes later today. I'll most likely end up just rewriting that entire portion of the code depending on the changes Dropbox has made. It looks like the are using 0auth 2.0 now.
Here let's try just the url for the code, https://github.com/dazemc/plugin_dbmc
I looked at your utils.py file and there is no exception handling to catch exception errors. I'd go the str approach to force the variable type. At least that way you won't get exception errors. I always try to eliminate exception errors in addons because the results can often be nondeterministic. Forcing types and catching exceptions are standard approaches I use. Yes,
Dropbox's v2 API is OAuth 2.0 . Kodi has an
OAuth 2.0 wrapper.
Thanks,
Jeff