diff --git a/docker/pysandbox/Dockerfile b/docker/pysandbox/Dockerfile index 349691f..6792187 100644 --- a/docker/pysandbox/Dockerfile +++ b/docker/pysandbox/Dockerfile @@ -4,7 +4,7 @@ FROM python:3.12-slim RUN apt-get update \ && apt-get install -y --no-install-recommends fonts-nanum libgl1 libglib2.0-0 \ && rm -rf /var/lib/apt/lists/* -RUN pip install --no-cache-dir numpy pandas matplotlib scipy openpyxl pillow \ +RUN pip install --no-cache-dir numpy pandas matplotlib scipy openpyxl pillow tabulate \ opencv-python-headless sympy scikit-learn statsmodels ENV MPLBACKEND=Agg MPLCONFIGDIR=/tmp/mpl HOME=/tmp PYTHONDONTWRITEBYTECODE=1 WORKDIR /work diff --git a/src/tools/python.ts b/src/tools/python.ts index 3b980ba..45b48d2 100644 --- a/src/tools/python.ts +++ b/src/tools/python.ts @@ -117,7 +117,10 @@ export const pythonEvalTool = { const beforeFiles = new Set(); try { function scanDir(dir: string, prefix: string) { - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + // 읽을 수 없는 폴더(.android-emulator 등 EACCES)에서 스캔 전체가 중단되면 새 파일 감지가 통째로 사라진다 + let entries: fs.Dirent[] = []; + try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; } + for (const entry of entries) { const rel = prefix ? `${prefix}/${entry.name}` : entry.name; const full = path.join(dir, entry.name); if (entry.isDirectory()) { scanDir(full, rel); } @@ -203,7 +206,9 @@ export const pythonEvalTool = { const newFiles: string[] = []; try { function scanDirAfter(dir: string, prefix: string) { - for (const entry of fs.readdirSync(dir, { withFileTypes: true })) { + let entries: fs.Dirent[] = []; + try { entries = fs.readdirSync(dir, { withFileTypes: true }); } catch { return; } + for (const entry of entries) { const rel = prefix ? `${prefix}/${entry.name}` : entry.name; const full = path.join(dir, entry.name); if (entry.isDirectory()) { scanDirAfter(full, rel); }