I am installing pluGET to automatically manage all of my plugins. Link Here (https://github.com/Neocky/pluGET) I installed all of the requirements and libraries. Still, It Doesnt Work. Full Error Log =>
> 0:01:55Error: Couldn't parse json of webrequest > Traceback (most recent call last): > File "/home/Cpd879/pluGET/pluget.py", line 45, in \ > handle_input() > File "/home/Cpd879/pluGET/src/handlers/handle_input.py", line 85, in handle_input > check_installed_plugins(input_selected_object, input_parameter) > File "/home/Cpd879/pluGET/src/plugin/plugin_updatechecker.py", line 341, in check_installed_plugins > plugin_count, plugins_with_udpates = check_update_available_installed_plugins(input_selected_object, config_values) > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/home/Cpd879/pluGET/src/plugin/plugin_updatechecker.py", line 316, in check_update_available_installed_plugins > plugin_spigot_id = search_plugin_spiget(plugin_file, plugin_file_name, plugin_file_version) # plugin_spigot_id isn't needed > ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^ > File "/home/Cpd879/pluGET/src/plugin/plugin_updatechecker.py", line 555, in search_plugin_spiget > for plugin in plugin_list: > TypeError: 'NoneType' object is not iterable I tried to fix it, but I am new to python. I expected it to give me the list. This error is really frustrating.
(pluginupdatechecker.py) Code -
""" Handles the plugin checking and updating """ import os import re import io from pathlib import Path import zipfile from rich.progress import track from rich.table import Table from rich.console import Console from urllib.error import HTTPError from zipfile import ZipFile from src.handlers.handle_config import config_value from src.handlers.handle_sftp import sftp_create_connection, sftp_download_file, sftp_validate_file_attributes, sftp_list_all from src.handlers.handle_ftp import ftp_create_connection, ftp_download_file, ftp_validate_file_attributes, ftp_list_all from src.plugin.plugin_downloader import get_specific_plugin_spiget, get_download_path from src.utils.console_output import rich_print_error from src.utils.utilities import api_do_request, create_temp_plugin_folder, remove_temp_plugin_folder class Plugin(): """ Create plugin class to store installed plugins inside it """ def __init__( self, plugin_file_name : str, plugin_name : str, plugin_file_version : str, plugin_latest_version : str, plugin_is_outdated : bool, plugin_repository : str, plugin_repository_data : list ) -> None: self.plugin_file_name = plugin_file_name self.plugin_name = plugin_name self.plugin_file_version = plugin_file_version self.plugin_latest_version = plugin_latest_version self.plugin_is_outdated = plugin_is_outdated self.plugin_repository = plugin_repository self.plugin_repository_data = plugin_repository_data @staticmethod def create_plugin_list() -> list: """ Creates a global array list to store plugins """ global INSTALLEDPLUGINLIST INSTALLEDPLUGINLIST = [] return INSTALLEDPLUGINLIST @staticmethod def add_to_plugin_list( plugin_file_name: str, plugin_name : str, plugin_file_version : str, plugin_latest_version : str, plugin_is_outdated : bool, plugin_repository : str, plugin_repository_data : list ) -> None: """ Adds a plugin to global installed plugin lists """ INSTALLEDPLUGINLIST.append(Plugin( plugin_file_name, plugin_name, plugin_file_version, plugin_latest_version, plugin_is_outdated, plugin_repository, plugin_repository_data )) return None def get_plugin_file_name(plugin_full_name: str) -> str: """ Finds the full plugin name of the given string Example LuckPerms-5.4.30.jar -> Luckperms :param plugin_full_name: Full filename of plugin :returns: Full plugin name """ plugin_full_name2 = plugin_full_name # find number.jar plugin_file_version = re.search(r'([\d.]+[.jar]+)', plugin_full_name2) try: plugin_file_version_full = plugin_file_version.group() except AttributeError: plugin_file_version_full = plugin_file_version # remove number from plugin name plugin_name_only = plugin_full_name2.replace(plugin_file_version_full, '') # remove - from plugin name plugin_name_only = re.sub(r'(\-$)', '', plugin_name_only) # remove -v from plugin name plugin_name_only = re.sub(r'(\-v$)', '', plugin_name_only) return plugin_name_only def get_plugin_file_version(plugin_full_name: str) -> str: """ Gets the version of the plugin :param plugin_full_name: Full filename of plugin :returns: Version of plugin as string """ plugin_file_version = re.search(r'([\d.]+[.jar]+)', plugin_full_name) plugin_file_version = plugin_file_version.group() plugin_file_version = plugin_file_version.replace('.jar', '') if plugin_file_version.endswith('.'): print("get_plugin_file_version endswith .") plugin_file_name, plugin_file_version = egg_cracking_jar(plugin_full_name) return plugin_file_version def get_latest_plugin_version_spiget(plugin_id : str) -> str: """ Gets the latest spigot plugin version :param plugin_id: Plugin Spigot ID :returns: Name of the latest update """ url = f"https://api.spiget.org/v2/resources/{pl ... ons/latest" latest_update_search = api_do_request(url) return str(latest_update_search["name"]) def create_plugin_version_tuple(plugin_version_string : str) -> tuple: """ Create a tuple of all version numbers :param plugin_version_string: Plugin Version :returns: Tuple of all version numbers """ return tuple(map(int, (plugin_version_string.split(".")))) def get_plugin_version_without_letters(plugin_version_string : str) -> str: """ Returns the version without letters from the plugin version :param plugin_version_string: Plugin Version :returns: Plugin version without letters """ return re.sub(r'([A-Za-z]*)', '', plugin_version_string) def compare_plugin_version(plugin_latest_version : str, plugin_file_version : str) -> bool: """ Check if plugin version is outdated :param plugin_latest_version: Latest available plugin version :param plugin_file_version: Installed plugin version :returns: bool if plugin version is outdated """ try: plugin_version_tuple = create_plugin_version_tuple( get_plugin_version_without_letters(plugin_file_version)) plugin_latest_version_tuple = create_plugin_version_tuple( get_plugin_version_without_letters(plugin_latest_version)) except ValueError: return False if plugin_version_tuple < plugin_latest_version_tuple: return True else: return False def ask_update_confirmation(input_selected_object : str) -> bool: """ Prints confirmation message of plugins which get updated and ask for confirmation :param input_selected_object: Command line input :returns: True or False if plugins should be udpated """ rich_console = Console() rich_console.print("Selected plugins with available Updates:") for plugin_file in INSTALLEDPLUGINLIST: if plugin_file.plugin_is_outdated == False: continue if input_selected_object != "all" and input_selected_object != "*": if re.search(input_selected_object, plugin_file.plugin_file_name, re.IGNORECASE): rich_console.print(f"[not bold][bright_magenta]{plugin_file.plugin_name}", end=' ') break rich_console.print(f"[not bold][bright_magenta]{plugin_file.plugin_name}", end=' ') rich_console.print() update_confirmation = input("Update these plugins [y/n] ? ") if str.lower(update_confirmation) != "y": rich_print_error("Aborting the update process") return False return True def egg_cracking_jar(plugin_file_name: str) -> str: """ Opens the plugin file as an archive and searches the plugin.yml file for the name and version entry :param plugin_file_name: Filename of the plugin which should be openend :returns: Plugin name in plugin.yml file :returns: Plugin version in plugin.yml file """ config_values = config_value() match config_values.connection: case "sftp": path_temp_plugin_folder = create_temp_plugin_folder() connection = sftp_create_connection() sftp_download_file(connection, plugin_file_name) path_plugin_jar = Path(f"{path_temp_plugin_folder}/{plugin_file_name}") case "ftp": path_temp_plugin_folder = create_temp_plugin_folder() connection = ftp_create_connection() path_plugin_jar = Path(f"{path_temp_plugin_folder}/{plugin_file_name}") ftp_download_file(connection, path_plugin_jar, plugin_file_name) case _: path_plugin_folder = config_values.path_to_plugin_folder path_plugin_jar = Path(f"{path_plugin_folder}/{plugin_file_name}") # later used to escape for-loop plugin_name = plugin_version = "" # open plugin if it is an archive and read plugin.yml line for line to find name & version try: with ZipFile(path_plugin_jar, "r") as plugin_jar: with io.TextIOWrapper(plugin_jar.open("plugin.yml", "r"), encoding="utf-8") as plugin_yml: for line in plugin_yml: if plugin_name != "" and plugin_version != "": break if re.match(r"^\s*?name: ", line): plugin_name = re.sub(r'^\s*?name: ', '', line) plugin_name = plugin_name.replace("\n", "").replace("'", "").replace('"', "") if re.match(r"^\s*?version: ", line): plugin_version = re.sub(r'^\s*?version: ', "", line) plugin_version = plugin_version.replace("\n", "").replace("'", "").replace('"', "") except FileNotFoundError: plugin_name = plugin_version = "" except KeyError: plugin_name = plugin_version = "" except zipfile.BadZipFile: plugin_name = plugin_version = "" # remove temp plugin folder if plugin was downloaded from sftp/ftp server if config_values.connection != "local": remove_temp_plugin_folder() return plugin_name, plugin_version def check_update_available_installed_plugins(input_selected_object: str, config_values: config_value) -> str: """ Gets installed plugins and checks it against the apis if there are updates for the plugins available :param input_selected_object: Command line input (default: all) :param config_values: Config values from config file :returns: Count of plugins, Count of plugins with available updates """ Plugin.create_plugin_list() match config_values.connection: case "sftp": connection = sftp_create_connection() plugin_list = sftp_list_all(connection) case "ftp": connection = ftp_create_connection() plugin_list = ftp_list_all(connection) case _: plugin_folder_path = config_values.path_to_plugin_folder plugin_list = os.listdir(plugin_folder_path) plugin_count = plugins_with_udpates = 0 # create simple progress bar from rich for plugin_file in track(plugin_list, description="[cyan]Checking...", transient=True, style="bright_yellow"): plugin_attributes = True match config_values.connection: case "sftp": plugin_attributes = sftp_validate_file_attributes( connection, f"{config_values.remote_plugin_folder_on_server}/{plugin_file}" ) case "ftp": plugin_attributes = ftp_validate_file_attributes( connection, f"{config_values.remote_plugin_folder_on_server}/{plugin_file}" ) case _: if not os.path.isfile(Path(f"{plugin_folder_path}/{plugin_file}")): plugin_attributes = False if not re.search(r'.jar$', plugin_file): plugin_attributes = False # skip plugin if no attributes were found to skip not valid plugin files if plugin_attributes == False: continue plugin_file_name = get_plugin_file_name(plugin_file) # supports command 'check pluginname' and skip the checking of every other plugin to speed things up a bit if input_selected_object != "all" and input_selected_object != "*": if not re.search(input_selected_object, plugin_file_name, re.IGNORECASE): continue plugin_file_version = get_plugin_file_version(plugin_file) # check repository of plugin plugin_spigot_id = search_plugin_spiget(plugin_file, plugin_file_name, plugin_file_version) # plugin_spigot_id isn't needed # TODO add more plugin repositories here # plugin wasn't found and not added to global plugin list so add try: if plugin_file not in INSTALLEDPLUGINLIST[-1].plugin_file_name: Plugin.add_to_plugin_list(plugin_file, plugin_file_name, plugin_file_version, 'N/A', False, 'N/A', ()) except IndexError: Plugin.add_to_plugin_list(plugin_file, plugin_file_name, plugin_file_version, 'N/A', False, 'N/A', ()) if INSTALLEDPLUGINLIST[-1].plugin_is_outdated == True: plugins_with_udpates += 1 plugin_count += 1 return plugin_count, plugins_with_udpates def check_installed_plugins(input_selected_object : str="all", input_parameter : str=None) -> None: """ Prints table overview of installed plugins with versions and available updates :param input_selected_object: Which plugin should be checked :param input_parameter: Optional parameters :returns: None """ config_values = config_value() plugin_count, plugins_with_udpates = check_update_available_installed_plugins(input_selected_object, config_values) # print rich table of found plugins and result rich_table = Table(box=None) rich_table.add_column("No.", justify="right", style="cyan", no_wrap=True) rich_table.add_column("Name", style="bright_magenta") rich_table.add_column("Installed V.", justify="right", style="green") rich_table.add_column("Latest V.", justify="right", style="bright_green") rich_table.add_column("Update available", justify="left", style="white") rich_table.add_column("Repository", justify="left", style="white") # start counting at 1 for all my non-programming friends

Error IMG
Источник: https://stackoverflow.com/questions/780 ... ython-venv