今天我正在编码,我遇到了这个不寻常的错误。下面是我的代码:
from direct.showbase.ShowBase import ShowBase
import cogManager
class application(ShowBase):
def __init__(self):
ShowBase.__init__(self)
playApplication = application()
playApplication.run()
错误:Traceback (most recent call last):
File "CogCreator.py", line 2, in <module>
import cogManager
File "C:UsersGeekyGamerGavinDocumentsToontown Phase FilesNEWcogManager.p
y", line 4
^
IndentationError: expected an indented block
但是当我删除
时,代码正常工作import cogManager
可以帮我一下吗?我糊涂了!
编辑:我没有空格/制表符混合!
编辑:修正了。谢谢!您可能在空行上有一个制表符,或者将制表符和空格混合在一起。按照PEP8编码标准,缩进应为每层4个空格。
尝试缩进def init(self):
from direct.showbase.ShowBase import ShowBase
import cogManager
class application(ShowBase):
def __init__(self):
ShowBase.__init__(self)
playApplication = application()
playApplication.run()