2013-04-24 1 views
-1

게임 엔진으로 파이썬에서 텍스트 모험을하려고합니다. 어쨌든이 오류 메시지가 계속 나타납니다.파이썬의 매개 변수 오류 - 텍스트 어드벤처 게임

from engine import game 
from engine import event 
from engine import place 


class TextAdventureGame(game): 
    def __init__(self): 
     super(TextAdventureGame, self).__init__() 
     self.introduction = ('''Welcome to Can You Escape text adventure game. 
You wake up in a dark room and you have no idea where you are.''') 

왜이 오류가 발생 : 여기

TypeError: module.__init__() takes at most 2 arguments (3 given) 내 코드?

class TextAdventureGame(game): TypeError: module.__init__() takes at most 2 arguments (3 given)

+0

클래스를 인스턴스화하는 방법은 무엇입니까? –

+2

질문의 제목을 구체적인 문제를 반영하는 것으로 변경하십시오. –

+2

1 : 전체 코드입니까? 2 :'super (TextAdventureGame, self) .__ init __()'을 제거하면 같은 오류가 발생합니까? –

답변

1

이 질문에 대답하기가 매우 어려운 방법으로 제기되고 있지만, 그것의 모습에서, 나는 오류가 여기에 있다고 말할 것이다 : 그것은 module.__init__()을 말하는

class TextAdventureGame(game): 

, 아니 TextAdventureGame.__init__(), 내 생각에 game 이상한 방식으로 사용되고 점점 모듈입니다. 그러나 코드에 대해 알지 못해도 game이 무엇인지, 또는 스택 추적을 보는 경우에는 훨씬 더 많은 작업을 수행 할 수 없습니다.

1

game은 모듈입니다. 대신 클래스를 기본 클래스로 사용해야합니다.

>>> import os 
>>> class C(os): 
... pass 
... 
Traceback (most recent call last): 
    File "<stdin>", line 1, in <module> 
TypeError: module.__init__() takes at most 2 arguments (3 given)