You are viewing a plain text version of this content. The canonical link for it is here.
Posted to dev@hugegraph.apache.org by "Kryst4lDem0ni4s (via GitHub)" <gi...@apache.org> on 2025/02/26 19:16:26 UTC
[I] [Bug] print_exception() missing 2 required positional arguments: 'value' and 'tb' [incubator-hugegraph-ai]
Kryst4lDem0ni4s opened a new issue, #180:
URL: https://github.com/apache/incubator-hugegraph-ai/issues/180
### Bug Type (问题类型)
exception / error (异常报错)
### Before submit
- [x] I had searched in the [issues](https://github.com/apache/incubator-hugegraph-ai/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'
)
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.
)
### Vertex/Edge example (问题点 / 边数据举例)
```javascript
```
### Schema [VertexLabel, EdgeLabel, IndexLabel] (元数据结构)
```javascript
```
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: dev-unsubscribe@hugegraph.apache.org.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
Re: [I] [Bug] print_exception() missing 2 required positional arguments: 'value' and 'tb' [incubator-hugegraph-ai]
Posted by "dosubot[bot] (via GitHub)" <gi...@apache.org>.
dosubot[bot] commented on issue #180:
URL: https://github.com/apache/incubator-hugegraph-ai/issues/180#issuecomment-2685977689
<!-- Greeting -->
Hey @Kryst4lDem0ni4s! I'm here to help you out with any bugs, questions, or contributions you have in mind. Let's tackle this together!
<!-- Answer -->
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:
```python
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:
```python
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.
<!-- Dosu Comment Footer -->
*To continue talking to [Dosu](https://dosu.dev), mention @dosu.*
---
<sup>Help Dosu learn! Give it feedback: [Great Response](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=great_response) | [Irrelevant Answer](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=irrelevant_answer) | [Incorrect Sources](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=incorrect_sources) | [Too Verbose](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=too_verbose) | [Hallucination](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=hallucination) | [Bug Report](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=bug_report) | [Other](https://app.dosu.dev/response-feedback/2d413d74-c570-4273-a88b-10733188c802?feedback_type=other)</sup>
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For queries about this service, please contact Infrastructure at:
users@infra.apache.org
---------------------------------------------------------------------
To unsubscribe, e-mail: issues-unsubscribe@hugegraph.apache.org
For additional commands, e-mail: issues-help@hugegraph.apache.org