[Tutor] Unpickling problem
Phil Bertram
phil.bertram@clear.net.nz
Thu, 18 Jan 2001 07:47:43 +1300
Hi all,
I have some code in a module named NPCObjects, describing 'Players',
'Matches' and collections of them. This code works fine in command line
mode. However I am trying to write a user interface using Tkinter.
When try to contruct my NPC object from a menu in Tkinter I get the
following error.
Note that the __init__ method of my NPC object unpickles a file to create
the object.
What is going wrong ?
Traceback (most recent call last):
File "C:\Program Files\Python20\Pythonwin\pywin\framework\scriptutils.py",
line 298, in RunScript
debugger.run(codeObject, __main__.__dict__, start_stepping=0)
File "C:\Program Files\Python20\Pythonwin\pywin\debugger\__init__.py",
line 60, in run
_GetCurrentDebugger().run(cmd, globals,locals, start_stepping)
File "C:\Program Files\Python20\Pythonwin\pywin\debugger\debugger.py",
line 582, in run
_doexec(cmd, globals, locals)
File "C:\Program Files\Python20\Pythonwin\pywin\debugger\debugger.py",
line 921, in _doexec
exec cmd in globals, locals
File "C:\Program Files\Python20\myScripts\NPC_MainFrame.py", line 107, in
?
app = NPC_MainFrame(root)
File "C:\Program Files\Python20\myScripts\NPC_MainFrame.py", line 7, in
__init__
self.npc=NPCObjects.NPC()
File "C:\Program Files\Python20\myScripts\NPCObjects.py", line 6, in
__init__
self.data=cPickle.load(file)
SystemError: Failed to import class Player from module __main__
>>>
Regards
Phil Bertram phil.bertram@clear.net.nz 07 850 9305 025 426 825