apache / apache/hugegraph-ai

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

Open
#180 1 comment 2 reactions 0 assignees View on GitHub
bug
Dominant language
Python
Stars
143
Forks
89
PR merge metrics
No merged PRs in 30d

Description

### 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'

![Image]([https://github.com/user-attachments/assets/c5e9627d-d76d-436c-bd1d-e26da9a315e9](https://github.com/user-attachments/assets/c5e9627d-d76d-436c-bd1d-e26da9a315e9))

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 "", 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 "", 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]([https://github.com/user-attachments/assets/10c6e761-3c0e-41f9-9305-62de6ee2282b](https://github.com/user-attachments/assets/10c6e761-3c0e-41f9-9305-62de6ee2282b))

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

```javascript

```

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

```javascript

```

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.