ai-coding-mines목차GitHub

`curl -o`는 404 본문도 파일에 쓴다

Python · DB

증상

SyntaxError: illegal target for annotation

원인이 안 보이는 에러. 실제로는 다운로드한 .py 파일의 내용이 404: Not Found 문자열이었다.

해법

curl -fsSL -o out.py URL || echo "다운로드 실패"

-f는 실패 시 파일을 만들지 않는다. 받은 뒤 즉시 검증한다.

python3 -c "import ast; ast.parse(open('out.py').read()); print('OK')"