Giter VIP home page Giter VIP logo

aerospace-knowledge-learning-and-testing-system's Introduction

航天知识问答系统

可以在这里下载

下面是源码:

# Author: RYCB studio
# -*- coding:utf-8 -*-
# MIT License
#
# Copyright (c) 2021 RYCBStudio
#
# Permission is hereby granted, free of charge, to any person obtaining a copy
# of this software and associated documentation files (the "Software"), to deal
# in the Software without restriction, including without limitation the rights
# to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
# copies of the Software, and to permit persons to whom the Software is
# furnished to do so, subject to the following conditions:
#
# The above copyright notice and this permission notice shall be included in all
# copies or substantial portions of the Software.
#
# THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
# IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
# FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
# AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
# LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
# OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
# SOFTWARE.
import os
import warnings
warnings.filterwarnings("ignore")
import configparser
from fuzzywuzzy import fuzz
import sys
import easygui as eg
import datetime
dt = datetime.datetime.now()
cfps = configparser.ConfigParser()
def main():
    init()
    exercises()
def init():
    with open("logs/RYCBStudio-Log.log", "w") as w:
        w.write("")
    log("Program is Initializing...")
    log("Loading Module ConfigParser...")
    try:
        cfps.read("config.cfg", encoding="GBK")
        log("Module ConfigParser is Loaded.")
    except ModuleNotFoundError:
        log("Module ConfigParser isn't Loaded.")
    except UnicodeError or UnicodeEncodeError:
        cfps.read("config.cfg", encoding="UTF-8")
        log("Module ConfigParser is Loaded.")
    eg.msgbox("\t\t\t    欢迎进入航天知识问答系统", "qyf-rycbstudio.github.io", ok_button="下一步")
def exercises():
    global fuzz_res
    choices = ["A", "B", "C"]
    eg.msgbox("题目开始!", "qyf-rycbstudio.github.io", "Start!")
    log("Now choice: Normal Exercise")
    ex_content = eval(cfps['exercise']["ex_dict"])
    answer = []
    log("Exercises are showing...")
    for i in ex_content:
        try:
            res = eg.buttonbox("第" + str(i) + "题:(滑动鼠标滚轮可以查看C选项)" + ex_content[str(i)], "qyf-rycbstudio.github.io",
                               choices)
            answer.append(res)
        except KeyError as k:
            log(str(k), "fatal")
    log("Judging...")
    ans = eval(cfps["exercise"]["ex_ans"])
    vk = 0
    for v in range(len(answer)):
        for k in range(len(ans)):
            fuzz_res = fuzz.ratio(answer[int(v)], ans[str(k + 1)])
            vk += fuzz_res
            cfps.set("Users", "usermarks", str(fuzz_res))
            cfps.write(open("config.cfg", "w"))
            break
    eg.msgbox("您的分数:" + str(fuzz_res), "qyf-rycbstudio.github.io")
def log(data, level="info", type="client"):
    with open("logs/RYCBStudio-Log.log", "a") as f:
        Nowtime = dt.strftime("%Y-%m-%d %T")
        if type == "client":
            if level == "info":
                f.write("[Client/INFO] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "warn":
                f.write("[Client/WARN] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "error":
                f.write("[Client/ERROR] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "fatal":
                f.write("[Client/FATAL] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "crash":
                f.write("[Client/CRASH_REPORT] " + '[' + Nowtime + '] ' + str(data) + "\n")
        else:
            if level == "info":
                f.write("[Server/INFO] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "warn":
                f.write("[Server/WARN] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "error":
                f.write("[Server/ERROR] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "fatal":
                f.write("[Server/FATAL] " + '[' + Nowtime + '] ' + str(data) + "\n")
            elif level == "crash":
                f.write("[Server/CRASH_REPORT] " + '[' + Nowtime + '] ' + str(data) + "\n")
if __name__ == "__main__":
    main()

aerospace-knowledge-learning-and-testing-system's People

Contributors

qyf-rycbstudio avatar

Watchers

 avatar

aerospace-knowledge-learning-and-testing-system's Issues

AKLTS-#BUG004

Traceback (most recent call last):
  File "E:\AKLTS++\AKLTS\Main.py", line 272, in <module>
    main()
  File "E:\AKLTS++\AKLTS\Main.py", line 112, in main
    checkForUpdates("https://gitee.com/RYCBStudio/Aerospace-Knowledge-Question-Answering-System/raw/main/latestVersion","https://gitee.com/RYCBStudio/Aerospace-Knowledge-Question-Answering-System/")
  File "E:\AKLTS++\AKLTS\Main.py", line 53, in checkForUpdates
    ur.urlretrieve("{}".format(rawServerName), ".\\update\\version")
  File "E:\python123\lib\urllib\request.py", line 247, in urlretrieve
    with contextlib.closing(urlopen(url, data)) as fp:
  File "E:\python123\lib\urllib\request.py", line 222, in urlopen
    return opener.open(url, data, timeout)
  File "E:\python123\lib\urllib\request.py", line 531, in open
    response = meth(req, response)
  File "E:\python123\lib\urllib\request.py", line 640, in http_response
    response = self.parent.error(
  File "E:\python123\lib\urllib\request.py", line 569, in error
    return self._call_chain(*args)
  File "E:\python123\lib\urllib\request.py", line 502, in _call_chain
    result = func(*args)
  File "E:\python123\lib\urllib\request.py", line 649, in http_error_default
    raise HTTPError(req.full_url, code, msg, hdrs, fp)
urllib.error.HTTPError: HTTP Error 403: Forbidden

这是Gitee的反爬虫措施,目前无法解决

@HHY-RYCBStudio

AKLTS-#BUG003

Solved-AKLTS-#BUG003

做题时,问题答案无法一一对应

AKLATS(AKQAS)-BUG#002

Traceback (most recent call last):
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 1348, in do_open
h.request(req.get_method(), req.selector, req.data, headers
File "D:\Program Files\Python\Python310\lib\http\client.py", line 1282, in request
self._send_request(method, url, body, headers, encode_chunked
File "D:\Program Files\Python\Python310\lib\http\client.py", line 1328, in _send_request
python self.endheaders(body, encode_chunked=encode_chunked)
File "D:\Program Files\Python\Python310\lib\http\client.py", line 1277, in endheaders
self._send_output(message_body, encode_chunked=encode_chunked)
File "D:\Program Files\Python\Python310\lib\http\client.py", line 1037, in _send_output
self.send(msg)
File "D:\Program Files\Python\Python310\lib\http\client.py", line 975, in send
self.connect()
File "D:\Program Files\Python\Python310\lib\http\client.py", line 1447, in connect
super().connect()
File "D:\Program Files\Python\Python310\lib\http\client.py", line 941, in connect
self.sock = self._create_connection(
File "D:\Program Files\Python\Python310\lib\socket.py", line 824, in create_connection
for res in getaddrinfo(host, port, 0, SOCK_STREAM):
File "D:\Program Files\Python\Python310\lib\socket.py", line 955, in getaddrinfo
for res in _socket.getaddrinfo(host, port, family, type, proto, flags):
socket.gaierror: [Errno 11004] getaddrinfo failed

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
File "D:\RYCBStudio\AKLTS\Main.py", line 206, in
main()
File "D:\RYCBStudio\AKLTS\Main.py", line 85, in main
checkForUpdates("https://raw.githubusercontent.com/QYF-RYCBStudio/Aerospace-Knowledge-Learning-And-Testing-System/main/")
File "D:\RYCBStudio\AKLTS\Main.py", line 49, in checkForUpdates
ur.urlretrieve("{}/latestVersion".format(serverName), "version")
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 241, in urlretrieve
with contextlib.closing(urlopen(url, data)) as fp:
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 216, in urlopen
return opener.open(url, data, timeout)
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 519, in open
response = self._open(req, data)
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 536, in _open
result = self._call_chain(self.handle_open, protocol, protocol +
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 496, in _call_chain
result = func(*args)
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 1391, in https_open
return self.do_open(http.client.HTTPSConnection, req,
File "D:\Program Files\Python\Python310\lib\urllib\request.py", line 1351, in do_open
raise URLError(err)
urllib.error.URLError: <urlopen error [Errno 11004] getaddrinfo failed>**

AKQAS-BUG#001

当点击“?”时,

Traceback (most recent call last):

File "E:\科创编程比赛参评\参评作品(2022省)\2022省馆信息素养提升实践活动(江油实验学校报绵阳5件)\航天知识学习检测系统(***)\航天知识学习检测系统\Main.py", line 168, in

main()

ile "E:\科创编程比赛参评\参评作品(2022省)\2022省馆信息素养提升实践活动(江油实验学校报绵阳5件)\航天知识学习检测系统(***)\航天知识学习检测系统\Main.py", line 47, in main

#### questions()

File "E:\科创编程比赛参评\参评作品(2022省)\2022省馆信息素养提升实践活动(江油实验学校报绵阳5件)\航天知识学习检测系统(***)\航天知识学习检测系统\Main.py", line 88, in questions

#### ex = eg.ccbox("请选择: ", "qyf-rycbstudio.github.io", ["继续", "返回"], image="./ques.png")

File "E:\python123\lib\site-packages\easygui\boxes\derived_boxes.py", line 91, in ccbox

#### return boolbox(msg=msg,

File "E:\python123\lib\site-packages\easygui\boxes\derived_boxes.py", line 147, in boolbox

#### assert False, "The user selected an unexpected response."

AssertionError: The user selected an unexpected response.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.