Невозможно перенести файлы из Интернета в Python с помощью configpaser, io и запросов. ⇐ Python
-
Гость
Невозможно перенести файлы из Интернета в Python с помощью configpaser, io и запросов.
This is my code:
from uu import decode import requests import configparser import io global config config = configparser.ConfigParser() url = "https://raw.githubusercontent.com/SCOS- ... e-list.ini" r = requests.get(url) content = r.content.decode() buf = io.StringIO(content) config.read(content) print("SCOS Store v1.0") print("Commands:\n1. Install\n2. Remove\n3. Exit") while True: command = input("> ") print(command) if (command == "1"): req = input("> Install > App: ") for x in (config["Apps"]["app-list"]): if config["Apps"]["name-" + x] == req: print("YES") if (command == "3"): exit() When I try to run it everything goes okay until the "Install" option is selected (I have made a test package named "Test"), then it doesn't want to to work, as it raises a key error.
Unfortunately I haven't found a solution, what it's supposed to do is output "YES" when a package is detected successfully, but it doesn't work...
Источник: https://stackoverflow.com/questions/781 ... d-requests
This is my code:
from uu import decode import requests import configparser import io global config config = configparser.ConfigParser() url = "https://raw.githubusercontent.com/SCOS- ... e-list.ini" r = requests.get(url) content = r.content.decode() buf = io.StringIO(content) config.read(content) print("SCOS Store v1.0") print("Commands:\n1. Install\n2. Remove\n3. Exit") while True: command = input("> ") print(command) if (command == "1"): req = input("> Install > App: ") for x in (config["Apps"]["app-list"]): if config["Apps"]["name-" + x] == req: print("YES") if (command == "3"): exit() When I try to run it everything goes okay until the "Install" option is selected (I have made a test package named "Test"), then it doesn't want to to work, as it raises a key error.
Unfortunately I haven't found a solution, what it's supposed to do is output "YES" when a package is detected successfully, but it doesn't work...
Источник: https://stackoverflow.com/questions/781 ... d-requests