回答此问题可获得 20 贡献值,回答如果被采纳可获得 50 分。
<p>所以我正在设计一个战舰后端系统,将运行在谷歌应用引擎。。。我昨天刚开始设计了一个游戏框架。在</p>
<p>不幸的是,我没有用python编写太多代码,因此对该语言的细节不太熟悉。当我试图运行程序时,我总是收到以下错误:</p>
<pre><code> File "C:\Users\Shlomo\Desktop\eclipse\plugins\org.python.pydev_2.7.5.2013052819\pysrc\pydev_runfiles.py", line 432, in __get_module_from_str
mod = __import__(modname)
File "C:\Users\Shlomo\workspace\battleship\Battleship.py", line 222, in <module>
battleship = BattleshipGame("Shlomo",1,1,4,1,1,2,5,2,1,3,3,3,1,4,2,4,1,5,5,5,"John",1,1,4,1,1,2,5,2,1,3,3,3,1,4,2,4,1,5,5,5)
File "C:\Users\Shlomo\workspace\battleship\Battleship.py", line 210, in __init__
field = self.player1_field.getField()
AttributeError: 'NoneType' object has no attribute 'getField'
ERROR: Module: Battleship could not be imported (file: C:\Users\Shlomo\workspace\battleship\Battleship.py).
</code></pre>
<p>所以我把这个错误翻译成变量字段没有被PlayerField对象初始化。。。在</p>
<p>这是我的代码:</p>
^{pr2}$
<p>抱歉,关于sytax,我无法粘贴到代码格式。这个代码可能有一些问题,但我还没能通过这个问题。。。在</p>
<p>我做错什么了?在</p>