Kodi Community Forum
Tools for kodi video scrap addon in python 3 - Printable Version

+- Kodi Community Forum (https://forum.kodi.tv)
+-- Forum: Development (https://forum.kodi.tv/forumdisplay.php?fid=32)
+--- Forum: Add-ons (https://forum.kodi.tv/forumdisplay.php?fid=26)
+---- Forum: Python 3 migration (https://forum.kodi.tv/forumdisplay.php?fid=281)
+---- Thread: Tools for kodi video scrap addon in python 3 (/showthread.php?tid=342682)



Tools for kodi video scrap addon in python 3 - alamata - 2019-04-03

Hey,...

I desire to update my video python 2 addon to python 3...

my python 2 video addon used  CommonFunctions from script.common.plugin.cache
but
it seems  not working with python 3 version...at this moment

so i have tried with  BeautifulSoup but no working  too.....

so my question is this one,....

what are the tools that i can use  to make a functionnal video scrap addon with kodi python 3 version,.....?

EDIT:: SOrry.. i havent seen that post --->>> :: https://forum.kodi.tv/showthread.php?tid=325637


RE: Tools for kodi video scrap addon in python 3 - ronie - 2019-04-03

a python 3 compatible version of Beautifulsoup is available in our repo for v19:
http://mirrors.kodi.tv/addons/migration/script.module.beautifulsoup4/


RE: Tools for kodi video scrap addon in python 3 - alamata - 2019-04-03

(2019-04-03, 17:54)ronie Wrote: a python 3 compatible version of Beautifulsoup is available in our repo for v19:
http://mirrors.kodi.tv/addons/migration/script.module.beautifulsoup4/

Hey ronie,...

Thx  for your intervention,...

but i still have issues with ""import from zip"" the file :  script.module.beautifulsoup4-4.6.0.0.zip

after manual install of the beautifulsoup addon,
i have got  this error :

Code:
ImportError: No module named html.entities

after manual add of html  lib from python 3 install folder,..

i have this issue


Code:
Error Type: <type 'exceptions.ValueError'>
                                            Error Contents: chr() arg not in range(256)

""and it s apparenetly related to the fact that  Python 2 chr give  a one character string in the ASCII range. This is an 8-bit string, so the maximum parameter value for
chr is 255.... In Python 3 you'll get a unicode character and unicode code points can go up to much higher values.""

...

have you an idea..?


RE: Tools for kodi video scrap addon in python 3 - ronie - 2019-04-03

hard to tell without seeing the code and a full Debug Log.

looking at the error alone, i'd say your not using a py3 version of kodi... but that's just a guess.


RE: Tools for kodi video scrap addon in python 3 - alamata - 2019-04-03

(2019-04-03, 22:45)ronie Wrote: ....
i'd say your not using a py3 version of kodi... but that's just a guess.

do you consider leia 18.1 version as a python3 kodi version..?


RE: Tools for kodi video scrap addon in python 3 - ronie - 2019-04-03

nope, you need to install the 'feature_python3' test build of kodi.
they can be found here: http://mirrors.kodi.tv/test-builds/


RE: Tools for kodi video scrap addon in python 3 - alamata - 2019-04-03

(2019-04-03, 23:35)ronie Wrote: nope, you need to install the 'feature_python3' test build of kodi.
the can be found here: http://mirrors.kodi.tv/test-builds/

ohh thx for the info .....and sorry for misunderstanding..

i go catch this version 'feature_python3' test build of kodi...now.. Wink)

thx for the enlightenment,...Wink)


RE: Tools for kodi video scrap addon in python 3 - gujal - 2019-04-04

@ronie 
I am trying to convert a couple of addons to py3 so that I may submit to the official repo.
I tried installing the script.common.plugin.cache-2.5.10.zip from
Code:
http://mirrors.kodi.tv/addons/migration/script.common.plugin.cache/
It immediately gives an error on install
from the log file
Code:
- NOTE: IGNORING THIS CAN LEAD TO MEMORY LEAKS!
Error Type: <class 'AttributeError'>
Error Contents: 'str' object has no attribute 'decode'
Traceback (most recent call last):
File "/home/gujal/.kodi/addons/script.common.plugin.cache/default.py", line 40, in <module>
 run()
File "/home/gujal/.kodi/addons/script.common.plugin.cache/default.py", line 30, in run
 sys.path = [settings.getAddonInfo('path').decode('utf-8') + "/lib"] + sys.path
AttributeError: 'str' object has no attribute 'decode'
-->End of Python script error report<--
From the error, it looks like the module is still using python2 calls and is not updated for python3
Here is the full debug log
https://paste.kodi.tv/ilopinunuj.kodi

Please advise


RE: Tools for kodi video scrap addon in python 3 - ronie - 2019-04-04

correct, script.common.plugin.cache has not been updated to python3.


RE: Tools for kodi video scrap addon in python 3 - alamata - 2019-04-05

@ronie

i come back to you because i still have issue with the script.module.beautifulsoup4-4.6.0.0.zip and the KodiSetup-20190305-66746cbe-feature_python3-x64.exe

i cant install from zip

the original addon.xml of beautifulsoup4-4.6.0.0 has xbmc.python"  version="2.25.0"

i have modified this to xbmc.python"  version="2.26.0"

but with no succes

and when i add manually script.module.beautifulsoup4-4.6.0.0
i have an import error  on from bs4 import BeautifulSoup


SOLUTION :
i have put some lib from python 3 install folder in my addon folder to do the trick


,....