Run The Bridge
(python error) module과 동일한 명의 .py를 썼을 때 본문
728x90
파이썬 random 함수로 간단하게 TEST 해보려는 찰나에 다음과 같은 오류를 만났다.
열심히 구글링 해 본 결과 https://www.codeit.kr/community/threads/12847 와 같은 사이트에서 해결책을 얻었다.
module과 동일한 명의. py를 쓰면 아래와 같은 오류를 볼 수 있다.
AttributeError: partially initialized module 'random' has no attribute 'randint' (most likely due to a circular import)
파일명을 'TEST_random.py'로 바꾸고 다시 실행해보았다. (pycharm에서 Rename 단축키는 Shift+F6)
실행이 잘 되었다.
감사합니다. Thank you
728x90
'Python > How to Use Python' 카테고리의 다른 글
(Python) Enter을 2번 입력받기 전 까지 계속 input 하는 방법 (0) | 2021.07.16 |
---|---|
(Python) 재귀함수(Recursive function)란? (2) | 2021.05.17 |
(API+Python) VirusTotal API 이용해서 URL 검색하기 (0) | 2021.04.03 |
(Python) Class 공부. 2 (0) | 2021.01.25 |
(Python) Class 공부 (0) | 2020.12.12 |
Comments