For example this code using
for python 3.15.4 but with python 3.15.5 need to change to
old code
if os.path.exists("{}bqts".format(pathLoc)):
with open("{}bqts".format(pathLoc), "r") as f:
refs = f.readlines()
after change .. It is more better and smoothly +added (encoding)
bqts_path = f"{pathLoc}bqts"
if not os.path.exists(bqts_path):
with open(bqts_path, "r", encoding="utf-8") as f:
refs = f.readlines()
also change Loop Structure and Event Processing
old
nl = len(refs)
for i in range(nl):
ref = refs[i]
new
for ref in refs:
ref = ref.strip()
if not ref:
continue
Reason: Direct iteration is more Pythonic and readable. Stripping whitespace and skipping empty lines prevents processing invalid references, improving robustness.also use (int)old
n = config.plugins.xtraEvent.searchNUMBER.value
for i in range(int(n)):
title = events[i][4]
description = events[i][6]
new
n = int(config.plugins.xtraEvent.searchNUMBER.value)
for i in range(min(n, len(events))):
title = events[i][4] or "" # Default to empty string
description = events[i][6] or "" # Default to empty string
also Threading
old
start_new_thread(self.downloadEvents, ())
Uses start_new_thread from the _thread module (commented alternative: import _thread).
new
Thread(target=self.downloadEvents).start()
Uses the threading.Thread class (assuming from threading import Thread).Reason: The threading module is the standard, high-level API for threading in Python, replacing the low-level _thread module. It provides better control and is more maintainable.