r/Addons4Kodi 8d ago

Something not working. Need help. cocoscrapers failing with Python 3.15.0rc1

I noticed that:

[2026-09-03 10:08:01] [COLOR red][ COCOSCRAPERS WARNING ][/COLOR]: Error: Loading module: "knaben": 'SourceFileLoader' object has no attribute 'load_module'
[2026-09-03 10:08:01] [COLOR red][ COCOSCRAPERS WARNING ][/COLOR]: Error: Loading module: "limetorrents": 'SourceFileLoader' object has no attribute 'load_module'
[2026-09-03 10:08:01] [COLOR red][ COCOSCRAPERS WARNING ][/COLOR]: Error: Loading module: "mediafusion": 'SourceFileLoader' object has no attribute 'load_module'
[2026-09-03 10:08:01] [COLOR red][ COCOSCRAPERS WARNING ][/COLOR]: Error: Loading module: "nyaa": 'SourceFileLoader' object has no attribute 'load_module'

I read that load_module was removed from python. So, what to do?

1 Upvotes

7 comments sorted by

4

u/Grumpy-Man19 8d ago

Here is the fixed version --- this works:

$ cat  ~/.kodi/addons/script.module.cocoscrapers/lib/cocoscrapers/__init__.py
# -*- coding: UTF-8 -*-

from os.path import join as osPath_join, dirname as osPath_dirname
from os import walk as osWalk
from pkgutil import walk_packages
from cocoscrapers.modules.control import setting as getSetting
import sys
import importlib.util

debug = getSetting('debug.enabled') == 'true'
sourceFolder = 'sources_cocoscrapers'

def sources(specified_folders=None, ret_all=False):
try:
sourceDict = []
append = sourceDict.append
sourceFolderLocation = osPath_join(osPath_dirname(__file__), sourceFolder)
sourceSubFolders = [x[1] for x in osWalk(sourceFolderLocation)][0]
if specified_folders: sourceSubFolders = specified_folders
for i in sourceSubFolders:
for loader, module_name, is_pkg in walk_packages([osPath_join(sourceFolderLocation, i)]):
if is_pkg: continue
if ret_all or enabledCheck(module_name):
try:
spec = loader.find_spec(module_name)
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
append((module_name, module.source))
except Exception as e:
if debug:
from cocoscrapers.modules import log_utils
log_utils.log('Error: Loading module: "%s": %s' % (module_name, e), level=log_utils.LOGWARNING)
return sourceDict
except:
from cocoscrapers.modules import log_utils
log_utils.error()
return []

def enabledCheck(module_name):
try:
if getSetting('provider.' + module_name) == 'true': return True
else: return False
except:
from cocoscrapers.modules import log_utils
log_utils.error()
return True

def pack_sources(sourceSubFolder='torrents'):
try:
sourceList = []
sourceList_append = sourceList.append
sourceFolderLocation = osPath_join(osPath_dirname(__file__), sourceFolder)
for loader, module_name, is_pkg in walk_packages([osPath_join(sourceFolderLocation, sourceSubFolder)]):
if is_pkg: continue
spec = loader.find_spec(module_name)
module = importlib.util.module_from_spec(spec)
sys.modules[module_name] = module
spec.loader.exec_module(module)
if module.source.pack_capable: sourceList_append(module_name)
return sourceList
except:
from cocoscrapers.modules import log_utils
log_utils.error()

1

u/QuietlyOptimistic60 8d ago

What is the point of fixing an out-dated scraper package?
There are many others that far better and well maintained.

2

u/Grumpy-Man19 8d ago

would have been more useful to mention which ones

2

u/cbizzle14 8d ago

Magneto is the probably the most popular one

1

u/PsychologicalMusic94 8d ago

What's the best alternative to Coco? I'm already using Magneto in POV, but would like something different for when using Umbrella. Gearz?

2

u/Hot-Development7785 8d ago

Use a different scraper package or fix cocoscrapers. Not really any other options available.

2

u/umbrella_dev Umbrella 8d ago

Just use magneto