From: Kevin A. <al...@se...> - 2004-09-28 17:03:18
|
On Sep 28, 2004, at 8:50 AM, Michael Redmond wrote: > I have checked out PythonCard 0.8.1 from CVS, and I consistently get > the following error message when I run resourceEditor. resourceEditor > actually loads, but the component menu is blank: > > Traceback (most recent call last): > File "C:\BigSnake\lib\site-packages\wx\_core.py", line 10673, in > <lambda> > lambda event: event.callable(*event.args, **event.kw) ) > File > "C:\BigSnake\Lib\site- > packages\PythonCard\tools\resourceEditor\resourceEd > itor.py", line 85, in on_initialize > self.buildComponentsMenu() > File > "C:\BigSnake\Lib\site- > packages\PythonCard\tools\resourceEditor\resourceEd > itor.py", line 285, in buildComponentsMenu > resource.loadComponentModule(name) > File "C:\BigSnake\Lib\site-packages\PythonCard\resource.py", line > 30, in loadC > omponentModule > raise ImportError, message > ImportError: cannot import module 'floatcanvas > > I am using python 2.3.4 and wxPython 2.5.2.8 for Python 2.3 > > I checked out PythonCard from CVS, and installed from the windows > binary file created by this command: > python setup.py --bdist_wininst > > Any ideas? I have uninstalled python, wxPython and PythonCard and > installed into a new location. Module floatcanvas does live in > several locations in under my Python installation: > > ..\site-packages\PythonCard\components > ..\site-packages\PythonCard\samples > ..\site-packages\PythonCard\samples\floatCanvasTest > ..\site-packages\PythonCard\build\lib\Pythoncard\components > ..\site-packages\wx\lib > ..\site-packages\wx\demo > ..\site-packages\wx\lib\floatcanvas > ..\site-packages\wxPython\lib > > To ask a very Newbie question, when an import statement is made, how > does python know where to look for the module? Could I possibly have > a path problem? > > I did not have this problem when I was using the 0.8 windows binary > distro of PythonCard from sourceforge.net Hmm, I'm not seeing that problem on either my Windows or Mac box. The PythonCard/components/floatcanvas.py module does its import of the wxPython FloatCanvas class as from wx.lib.floatcanvas import FloatCanvas as FCanvas in order to avoid name collision problems. In resource.py it should be attempting to load the component from the PythonCard/components directory and for some reason on your box that is causing an exception. Does the floatCanvasTest sample also fail? This won't be exactly the same, but start Python and at the >>> prompt type from PythonCard.components import floatcanvas and see if that also throws an exception. How about if you do that from the codeEditor shell? Does it make any difference what directory you start in if you run from the command-line? You can check your path that Python uses to import modules and packages with the following lines in the shell: import sys sys.path Is anyone else working from cvs seeing this problem?! BTW, there is a problem with the actual wx.lib.floatcanvas module since Chris used the method name Move when he shouldn't have. It has been changed to MoveImage along with the call to Move in the code, but that isn't in wxPython 2.5.2.8, so you would have to change it yourself. If nothing else works, I suggest simply renaming components/floatcanvas.py to floatcanvas.txt or something like that so that the resourceEditor doesn't attempt to import it until we get this problem figured out. ka |