block / block/agent-task-queue

[Bug] ModuleNotFoundError: No module named 'resource'

Đang mở Phù hợp với người mới
#33 0 bình luận 0 reaction 0 người được giao Xem trên GitHub
bug
Ngôn ngữ chính
Python
Star
68
Fork
7
Merge trung bình
51 phút
Pull request đã merge (30 ngày)
1

Mô tả

**Describe the bug**
Encountered error while attempting to run agent-task-queue

**To Reproduce:**
*Steps to reproduce the behavior:*
1. Run command $uvx agent-task-queue@latest$
2. Encountered error
```powershell
Traceback (most recent call last):
File "", line 203, in _run_module_as_main
File "", line 88, in _run_code
File "C:\Users\sheld\AppData\Local\uv\cache\archive-v0\d0WBs-76xzVqcxx1\Scripts\agent-task-queue.exe\__main__.py", line 4, in
from task_queue import main
File "C:\Users\sheld\AppData\Local\uv\cache\archive-v0\d0WBs-76xzVqcxx1\Lib\site-packages\task_queue.py", line 12, in
import resource
ModuleNotFoundError: No module named 'resource'
```

**Environment (please complete the following information):**
- OS: Windows 11

**Additional Notes**
`import resource` is `Linux\MacOS` specific.

For cross-compatibility, we could use
```
import os
import psutil
```
then change
```python
def get_memory_mb() -> float:
"""Get current process memory usage in MB (RSS - resident set size)."""
usage = resource.getrusage(resource.RUSAGE_SELF)
# ru_maxrss is in bytes on Linux, kilobytes on macOS
if os.uname().sysname == "Darwin":
return usage.ru_maxrss / (1024 * 1024) # KB to MB
return usage.ru_maxrss / 1024 # bytes to MB on Linux
```
to
```python
def get_memory_mb() -> float:
"""Get current process memory usage in MB (RSS - resident set size)."""
return psutil.Process(os.getpid()).memory_info().rss / (1024 ** 2)

```

Hướng dẫn đóng góp

Mở hướng dẫn đóng góp

Hướng nghiên cứu

Start in task_queue.py at the import resource and the get_memory_mb function shown in the issue. Run uvx agent-task-queue@latest on Windows to reproduce the ModuleNotFoundError, then verify the command starts successfully and reports process memory without the import failure.

Do mô hình lập chỉ mục viết ra từ nội dung của issue.

Đánh giá

Công nghệ
python
Lĩnh vực
cli
Loại issue
Lỗi
Độ khó
2/5
Thời gian dự kiến
1-3 giờ
Mức độ hoạt động
Ít trao đổi
Độ rõ ràng
Đặc tả rõ ràng
Mức phù hợp với người mới
75/100

Nhận issue mới trong hộp thư của bạn

Bản tóm tắt ngắn những issue GitHub phù hợp với người mới.