lhllhx / PT_signin

Pt站点的自动签到和数据统计
https://blog.3628688.xyz/index.php/2022/07/25/利用阿里云实现pt自动签到和数据统计/
244 stars 114 forks source link

运行环境需要python 3.10 3.9 无法运行 #19

Closed yswtrue closed 1 year ago

yswtrue commented 1 year ago

但是阿里云的云函数默认没有3.10的运行层

lhllhx commented 1 year ago

提交log 我这里没问题

yswtrue commented 1 year ago
{
    "errorMessage": "unsupported operand type(s) for |: 'type' and 'NoneType'",
    "errorType": "TypeError",
    "stackTrace": [
        [
            "File \"/code/index.py\"",
            "line 55",
            "in handler",
            "main(avg)"
        ],
        [
            "File \"/opt/python/flexget/__init__.py\"",
            "line 44",
            "in main",
            "manager.start()"
        ],
        [
            "File \"/opt/python/flexget/manager.py\"",
            "line 382",
            "in start",
            "self.initialize()"
        ],
        [
            "File \"/opt/python/flexget/manager.py\"",
            "line 224",
            "in initialize",
            "plugin.load_plugins("
        ],
        [
            "File \"/opt/python/flexget/plugin.py\"",
            "line 550",
            "in load_plugins",
            "_load_plugins_from_dirs(extra_plugins)"
        ],
        [
            "File \"/opt/python/flexget/plugin.py\"",
            "line 468",
            "in _load_plugins_from_dirs",
            "_import_plugin(module_name, plugin_path)"
        ],
        [
            "File \"/opt/python/flexget/plugin.py\"",
            "line 419",
            "in _import_plugin",
            "import_module(module_name)"
        ],
        [
            "File \"/var/fc/lang/python3.9/lib/python3.9/importlib/__init__.py\"",
            "line 127",
            "in import_module",
            "return _bootstrap._gcd_import(name[level:], package, level)"
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 1030",
            "in _gcd_import",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 1007",
            "in _find_and_load",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 986",
            "in _find_and_load_unlocked",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 680",
            "in _load_unlocked",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap_external>\"",
            "line 850",
            "in exec_module",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 228",
            "in _call_with_frames_removed",
            ""
        ],
        [
            "File \"/tmp/plugins/iyuu_auto_reseed.py\"",
            "line 129",
            "in <module>",
            "class PluginIYUUAutoReseed:"
        ],
        [
            "File \"/tmp/plugins/iyuu_auto_reseed.py\"",
            "line 147",
            "in PluginIYUUAutoReseed",
            "'properties': executor.build_reseed_schema()"
        ],
        [
            "File \"/tmp/plugins/ptsites/executor.py\"",
            "line 113",
            "in build_reseed_schema",
            "site_class = get_site_class(module.name)"
        ],
        [
            "File \"/tmp/plugins/ptsites/executor.py\"",
            "line 132",
            "in get_site_class",
            "site_module = importlib.import_module(f'flexget.plugins.ptsites.sites.{class_name.lower()}')"
        ],
        [
            "File \"/var/fc/lang/python3.9/lib/python3.9/importlib/__init__.py\"",
            "line 127",
            "in import_module",
            "return _bootstrap._gcd_import(name[level:], package, level)"
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 1030",
            "in _gcd_import",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 1007",
            "in _find_and_load",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 986",
            "in _find_and_load_unlocked",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 680",
            "in _load_unlocked",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap_external>\"",
            "line 850",
            "in exec_module",
            ""
        ],
        [
            "File \"<frozen importlib._bootstrap>\"",
            "line 228",
            "in _call_with_frames_removed",
            ""
        ],
        [
            "File \"/tmp/plugins/ptsites/sites/soulvoice.py\"",
            "line 11",
            "in <module>",
            "class MainClass(AttendanceHR, ReseedPasskey):"
        ],
        [
            "File \"/tmp/plugins/ptsites/sites/soulvoice.py\"",
            "line 24",
            "in MainClass",
            ") -> Response | None:"
        ]
    ]
}
yswtrue commented 1 year ago

怀疑是新环境的问题

yswtrue commented 1 year ago
python-telegram-bot==12.8
brotli
baidu-aip
pillow
pandas
matplotlib
fuzzywuzzy
python-Levenshtein
pyppeteer
pyppeteer_stealth
chardet
flexget==3.3.19
requests

这是依赖

yswtrue commented 1 year ago

我看了这个写法的确是要3.10才有的

-> Response | None:
badpinkman commented 1 year ago

我这里也遇到了同样的问题. 发现最后成功的时间为2022-12-30日.

lhllhx commented 1 year ago

上游项目更新所致 已请求上游项目修改

lhllhx commented 1 year ago

修了

badpinkman commented 1 year ago

我这边重新测试了一下 依旧存在问题呢 大佬, 你那边环境是阿里云 Py3.9的环境吗?

badpinkman commented 1 year ago

怀疑自己的代码不是最新的,去了您的博客想重新获取一下最新的代码, 发现其中博客中的Python代码GitHub中的代码不一致, 详细测试信息: 使用GitHub中的代码报的错: { "errorMessage": "File is not a zip file", "errorType": "BadZipFile", "stackTrace": [ [ "File \"/code/index.py\"", "line 43", "in handler", "zipFile = zipfile.ZipFile('/tmp/config.zip')" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1257", "in __init__", "self._RealGetContents()" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1324", "in _RealGetContents", "raise BadZipFile(\"File is not a zip file\")" ] ] }

使用客中的Python代码报的错与上边的大哥一样.

不知道是我使用存在错误 还是怎么样 希望大佬有空的时候麻烦看下.

-- 补充: 阿里云的层也重新创建了, 使用的是GitHub中的requirements 重新创建层后, 完成的上方测试.

yswtrue commented 1 year ago

怀疑自己的代码不是最新的,去了您的博客想重新获取一下最新的代码, 发现其中博客中的Python代码GitHub中的代码不一致, 详细测试信息: 使用GitHub中的代码报的错: { "errorMessage": "File is not a zip file", "errorType": "BadZipFile", "stackTrace": [ [ "File \"/code/index.py\"", "line 43", "in handler", "zipFile = zipfile.ZipFile('/tmp/config.zip')" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1257", "in __init__", "self._RealGetContents()" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1324", "in _RealGetContents", "raise BadZipFile(\"File is not a zip file\")" ] ] }

使用客中的Python代码报的错与上边的大哥一样.

不知道是我使用存在错误 还是怎么样 希望大佬有空的时候麻烦看下.

-- 补充: 阿里云的层也重新创建了, 使用的是GitHub中的requirements 重新创建层后, 完成的上方测试.

这个错我记得是那个Authorization这个头拼错了

badpinkman commented 1 year ago

我刚检查了一下代码, 可能是还没同步上游代码导致... 我真2... 到时候会自动同步上游代码, 同步完了就可以了. 坐等同步吧.

lhllhx commented 1 year ago

怀疑自己的代码不是最新的,去了您的博客想重新获取一下最新的代码, 发现其中博客中的Python代码GitHub中的代码不一致, 详细测试信息: 使用GitHub中的代码报的错: { "errorMessage": "File is not a zip file", "errorType": "BadZipFile", "stackTrace": [ [ "File \"/code/index.py\"", "line 43", "in handler", "zipFile = zipfile.ZipFile('/tmp/config.zip')" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1257", "in __init__", "self._RealGetContents()" ], [ "File \"/var/fc/lang/python3.9/lib/python3.9/zipfile.py\"", "line 1324", "in _RealGetContents", "raise BadZipFile(\"File is not a zip file\")" ] ] }

使用客中的Python代码报的错与上边的大哥一样.

不知道是我使用存在错误 还是怎么样 希望大佬有空的时候麻烦看下.

-- 补充: 阿里云的层也重新创建了, 使用的是GitHub中的requirements 重新创建层后, 完成的上方测试.

三小时前自动同步了 昨天忘了手动同步了 现在可以测试了

github有一次api的更新 具体怎么更新不清楚 反正就是旧版api token用旧版代码 新版api token只能用新版本代码 这个报错应该是因为你用了旧版api但是用新版代码导致的 你这种应该维持原状别动就行了

一般以github代码为最新 博客很久没更新了

badpinkman commented 1 year ago

已经测试过了. 上述问题已经ok了. 感谢.

yswtrue commented 1 year ago

可以了,谢谢