나는 Curses programming HowTo on the Python site을 따르고 있습니다.하지만 다소 기괴한 문제가 있습니다.AttributeError를 반환하는 저주 : '모듈'객체에는 'initscr'속성이 없습니다.
내 코드는 현재 매우 짧습니다. 실제로 을 입력하지 마십시오.이 오류로 인해 다음 단계로 이동할 수 없었습니다.
import curses
#from curses import wrapper
stdscr = curses.initscr()
curses.noecho()
curses.cbreak()
stdscr.keypad(True)
def main(stdscr):
begin_x = 20; begin_y = 7
height = 5; width = 40
win = curses.newwin(height, width, begin_y, begin_x)
stdscr.refresh()
stdscr.getkey()
if __name__ == '__main__':
wrapper(main)
과 역 추적 : 여기 내 코드의 그 날 또 다른 오류를주고 있었기 때문에 나는 from curses import wrapper
에서 주석
Traceback (most recent call last):
File "curses.py", line 1, in <module>
import curses
File "/home/nate/Documents/Programming/Python/curses.py", line 4, in <module>
stdscr = curses.initscr()
AttributeError: 'module' object has no attribute 'initscr'
,
Traceback (most recent call last):
File "curses.py", line 1, in <module>
import curses
File "/home/nate/Documents/Programming/Python/curses.py", line 2, in <module>
from curses import wrapper
ImportError: cannot import name wrapper
하지만 난 그 다른 질문이 될 것입니다 가정 .
나는 curses를 배우기 위해 지금 단어에 대한 튜토리얼 단어를 따르고 있지만, 현재는 내가하는 일은 Python : P에있는 curses를 사용하는 것이다. 왜 내가이 일을 할 수 아니다 : (D 고맙게도)
내가 우분투 13.10에 파이썬 3.3.2을 실행하고, 그래서 this question이 함께 할 수 없다 그는 Windows를 사용했다으로 내가 아니다 ? Python 사이트에서 직접 복사하므로 제대로 작동한다고 생각할 수 있습니다!
오 물론 ... 내가 그랬다고 믿을 수 없다 : P 감사 : D –
오류가 계속되면 같은 폴더에서'curses.pyc' 파일을 확인하고 삭제하십시오. –