Skip to content

以模块方式运行一个python脚本并调用Application.call时报错 #41

@zgx949

Description

@zgx949

PC:macbook air M3 16+512
环境:Python 3.12.0 (v3.12.0:0fb18b02c8, Oct 2 2023, 09:45:56) [Clang 13.0.0 (clang-1300.0.29.30)] on darwin
报错内容:

Traceback (most recent call last):
  File "/Users/lefthand/yaduo-ai/yaduo-ai/XianyuAgent/main-record.py", line 503, in handle_message
    bot_reply, _, use_tool = chat_with_context(new_context, query_type='youxia', item_desc=item_description)
                             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lefthand/yaduo-ai/yaduo-ai/YaduoAi/mcp.py", line 100, in chat_with_context
    response = Application.call(
               ^^^^^^^^^^^^^^^^^
  File "/Users/lefthand/yaduo-ai/yaduo-ai/.venv/lib/python3.12/site-packages/dashscope/app/application.py", line 134, in call
    request = _build_api_request(model='',
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lefthand/yaduo-ai/yaduo-ai/.venv/lib/python3.12/site-packages/dashscope/api_entities/api_request_factory.py", line 81, in _build_api_request
    request = HttpRequest(url=http_url,
              ^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Users/lefthand/yaduo-ai/yaduo-ai/.venv/lib/python3.12/site-packages/dashscope/api_entities/http_request.py", line 46, in __init__
    super().__init__()
  File "/Users/lefthand/yaduo-ai/yaduo-ai/.venv/lib/python3.12/site-packages/dashscope/api_entities/base_request.py", line 16, in __init__
    platform.platform(),
    ^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/platform.py", line 1285, in platform
    bits, linkage = architecture(sys.executable)
                    ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/platform.py", line 720, in architecture
    fileout = _syscmd_file(executable, '')
              ^^^^^^^^^^^^^^^^^^^^^^^^^^^^
  File "/Library/Frameworks/Python.framework/Versions/3.12/lib/python3.12/platform.py", line 678, in _syscmd_file
    return output.decode('latin-1')
           ^^^^^^^^^^^^^
AttributeError: 'str' object has no attribute 'decode'. Did you mean: 'encode'?

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions