========= RESTART: C:\Users\Administrator\Documents\ddah0329\turtle.py =========
Traceback (most recent call last):
File "C:\Users\Administrator\Documents\ddah0329\turtle.py", line 1, in <module>
import turtle
File "C:\Users\Administrator\Documents\ddah0329\turtle.py", line 2, in <module>
t=turtle.Turtle()
AttributeError: partially initialized module 'turtle' has no attribute 'Turtle' (most likely due to a circular import). Did you mean: 'turtle'?
위 사진과 같이 실행했을 때 NameError OR AttributeError가 뜨는데
이런 종류의 오류는 내가 저장한 파일의 이름이 외장함수의 이름 OR 외장 함수 내에 들어있는 함수의 이름과 같을 때 발생한다.
결국 내가 turtle.py로 저장했기 때문에 생긴 오류인 것이다.
결론
절대로 파일 명을 파이썬 내 사용하는 내,외장 함수 이름으로 저장하면 안된다.
728x90
'Programming > Python' 카테고리의 다른 글
turtle 모듈 t.color 와 t.fillcolor 차이점 (1) | 2024.01.04 |
---|---|
Python 입력함수 input (aka. scanf) (0) | 2024.01.04 |
Python 변수 설정 (+ 주의사항) (1) | 2024.01.04 |
[Python] turtle 모듈로 도형 그리기 (반복 명령어) (0) | 2024.01.03 |
[Python] 파이썬을 스크래치처럼? import turtle 모듈 사용기 (이동, 펜) (0) | 2024.01.03 |