Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Bug] print_exception() missing 2 required positional arguments: 'value' and 'tb' #180

Open
1 task done
Kryst4lDem0ni4s opened this issue Feb 26, 2025 · 1 comment
Open
1 task done
Labels
bug Something isn't working

Comments

@Kryst4lDem0ni4s
Copy link
Contributor

Bug Type (问题类型)

exception / error (异常报错)

Before submit

  • I had searched in the issues and found no similar issues.

Environment (环境信息)

  • Server Version: v1.5.0
  • Instance Running: incubator-hugegraph-ai\hugegraph-llm\src\hugegraph_llm\demo\rag_demo
  • Directory: incubator-hugegraph-ai/hugegraph-llm/src
  • Command: python -m hugegraph_llm.demo.rag_demo.app
  • Python version: 3.9.13
  • Windows 11

Expected & Actual behavior (期望与实际表现)

Source of Issue: C:\Users\Khwaish.vscode\incubator-hugegraph-ai\hugegraph-python-client\src\pyhugegraph\utils\huge_config.py
Problematic Code:
line 66:

except Exception as e:  # pylint: disable=broad-exception-caught
                traceback.print_exception(e)
                self.gs_supported = False
                log.warning(
                    "Failed to retrieve API version information from the server, reverting to default v1."
                )

Expected Behavior: Upon clicking "Extract Graph Data", the output should be generated for the RAG index builder.

Actual Behavior: Error thrown and unable to perform "Extract Graph Data". Displays errors on both the console and the UI.
Error: Traceback (most recent call last):
File "C:\Users\Khwaish.vscode\incubator-hugegraph-ai.venv\lib\site-packages\pyhugegraph\utils\huge_config.py", line 68, in post_init
traceback.print_exception(e)
TypeError: print_exception() missing 2 required positional arguments: 'value' and 'tb'

Image

Cause of error discovered:
The traceback.print_exception function requires two more positional arguments, value and tb, which are not provided in the calls from KG Builder.
i.e:

builder = KgBuilder(LLMs().get_chat_llm(), Embeddings().get_embedding(), get_hg_client())
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\hugegraph-llm\src\hugegraph_llm\utils\hugegraph_utils.py", line 39, in get_hg_client
return PyHugeClient(
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\client.py", line 59, in __init__
self.cfg = HGraphConfig(ip, port, user, pwd, graph, graphspace, timeout or (0.5, 15.0))
File "<string>", line 11, in __init__
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\utils\huge_config.py", line 66, in __post_init__
traceback.print_exception(e)

Solution discovered:

builder = KgBuilder(LLMs().get_chat_llm(), Embeddings().get_embedding(), get_hg_client())
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\hugegraph-llm\src\hugegraph_llm\utils\hugegraph_utils.py", line 39, in get_hg_client
return PyHugeClient(
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\client.py", line 59, in __init__
self.cfg = HGraphConfig(ip, port, user, pwd, graph, graphspace, timeout or (0.5, 15.0))
File "<string>", line 11, in __init__
File "C:\Users\Khwaish\.vscode\incubator-hugegraph-ai\.venv\lib\site-packages\pyhugegraph\utils\huge_config.py", line 66, in __post_init__
exc_type, exc_value, tb = sys.exc_info()
traceback.print_exception(exc_type, exc_value, tb)

Actual Behavior:
During the try block, throws exception in the console, then proceeds to complete functions.

Image

Vertex/Edge example (问题点 / 边数据举例)

Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)

@Kryst4lDem0ni4s Kryst4lDem0ni4s added the bug Something isn't working label Feb 26, 2025
Copy link

dosubot bot commented Feb 26, 2025

Hey @Kryst4lDem0ni4s! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's tackle this together!

The error you're encountering is due to incorrect usage of the traceback.print_exception function. This function requires three arguments: exc_type, exc_value, and tb, which represent the exception type, value, and traceback, respectively.

To fix the issue, you should modify the code in huge_config.py to correctly pass these arguments. Here's how you can do it:

Replace the problematic code:

except Exception as e:  # pylint: disable=broad-exception-caught
    traceback.print_exception(e)
    self.gs_supported = False
    log.warning(
        "Failed to retrieve API version information from the server, reverting to default v1."
    )

With the corrected version:

except Exception as e:  # pylint: disable=broad-exception-caught
    exc_type, exc_value, tb = sys.exc_info()
    traceback.print_exception(exc_type, exc_value, tb)
    self.gs_supported = False
    log.warning(
        "Failed to retrieve API version information from the server, reverting to default v1."
    )

This change ensures that the traceback.print_exception function receives the correct arguments, allowing it to properly print the exception details.

To continue talking to Dosu, mention @dosu.


Help Dosu learn! Give it feedback: Great Response | Irrelevant Answer | Incorrect Sources | Too Verbose | Hallucination | Bug Report | Other

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
1 participant