anthropics / anthropics/anthropic-sdk-python

pdfplumber broken in code_execution sandbox — charset_normalizer mypyc module missing

Đang mở
#1,340 1 bình luận 0 reaction 0 người được giao Xem trên GitHub
api
Ngôn ngữ chính
Python
Star
3.9k
Fork
853
Merge trung bình
1 ngày 18 giờ
Pull request đã merge (30 ngày)
11

Mô tả

## Environment

- Tool: `code_execution_20250825` sandbox
- Python: 3.11.12, Linux x86_64

## Error

```
ModuleNotFoundError: No module named '81d243bd2c585b0f4821__mypyc'
```

Full traceback:
```
File "", line 1, in
File "/usr/local/lib/python3.11/site-packages/pdfplumber/__init__.py", line 11, in
import pdfminer.pdftypes
File "/usr/local/lib/python3.11/site-packages/pdfminer/pdftypes.py", line 22, in
from pdfminer.psparser import LIT, PSObject
File "/usr/local/lib/python3.11/site-packages/pdfminer/psparser.py", line 20, in
from pdfminer.utils import choplist
File "/usr/local/lib/python3.11/site-packages/pdfminer/utils.py", line 31, in
import charset_normalizer
File "/usr/local/lib/python3.11/site-packages/charset_normalizer/__init__.py", line 24, in
from .api import from_bytes, from_fp, from_path, is_binary
File "/usr/local/lib/python3.11/site-packages/charset_normalizer/api.py", line 5, in
from .cd import (
ModuleNotFoundError: No module named '81d243bd2c585b0f4821__mypyc'
```

## Reproduction

```python
import pdfplumber
```

This fails immediately on import inside the code execution sandbox.

## Root Cause

The `charset_normalizer` package (dependency chain: `pdfplumber` → `pdfminer` → `charset_normalizer`) ships mypyc-compiled C extensions. The hash-prefixed module name (`81d243bd2c585b0f4821__mypyc`) indicates a compiled `.so` binary that is either missing from the sandbox image or was built for a different platform/Python ABI.

## Impact

`pdfplumber` is documented as a pre-installed package in the code execution sandbox but is completely unusable. Users who upload PDFs and rely on the agent choosing `pdfplumber` for table/text extraction hit this error.

## Workaround

Use `pypdf` instead, which works correctly in the sandbox:

```python
from pypdf import PdfReader
reader = PdfReader("file.pdf")
for page in reader.pages:
print(page.extract_text())
```

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

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

Đánh giá

Issue này chưa được đánh giá.

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.