问题
When I start boa-constructor from the command line by starting the script "Boa.py", I got the message says "
D:\Python27\Lib\site-packages\boa-constructor>python Boa.py
Starting Boa Constructor v0.6.1
importing wxPython
reading user preferences
Traceback (most recent call last):
File "Boa.py", line 271, in <module>
import Preferences, Utils
File "D:\Python27\Lib\site-packages\boa-constructor\Preferences.py", line 151
in <module>
execfile(file)
File "C:\Users\madfrog\.boa-constructor\prefs.rc.py", line 26, in <module>
splitterStyle = wx.SP_LIVE_UPDATE | wx.SP_3DSASH | wx.NO_3D
AttributeError: 'module' object has no attribute 'NO_3D'
My python version is 2.7.4 and I download wxPyton "32-bit Python 2.7". There are someone say it because the unmatched wxPython version, but there are only 64-bit or 32 bit for me, I don't know how to handle this problem. Maybe should I reinstall the python, which version is 2.6?
Thanks for your help.
回答1:
I had the same problem. I can't tell you why. I can just tell you how I fixed it.
After you download and unzip the boa files go into the boa folder (On a Mac this could be: /Users/your_user_name/Downloads/boa-constructor-0.6.1).
Then: "grep" for every file containing NO_3D (or use whatever you want to search for a string in a set of files, I don't know how windows does this): In my case I did: grep -ir NO_3D *
A list of files comes up. Simply edit each such file (there are ~6) and remove any mentioning of "wx.NO_3D".
E.g., in Companions/BaseCompanions.py I find a match:
"self.windowStyles = ['wx.CAPTION', 'wx.MINIMIZE_BOX', 'wx.MAXIMIZE_BOX',
'wx.THICK_FRAME', 'wx.SIMPLE_BORDER', 'wx.DOUBLE_BORDER',
'wx.SUNKEN_BORDER', 'wx.RAISED_BORDER', 'wx.STATIC_BORDER',.
'wx.TRANSPARENT_WINDOW', 'wx.NO_3D', 'wx.TAB_TRAVERSAL',.
'wx.WANTS_CHARS', 'wx.NO_FULL_REPAINT_ON_RESIZE', 'wx.VSCROLL',.
'wx.HSCROLL', 'wx.CLIP_CHILDREN', 'wx.NO_BORDER', 'wx.ALWAYS_SHOW_SB']"
You see the 'wx.NO_3D' in the middle somewhere. Remove it and save the file. Keep doing this for all files.
However, there is a minor complication in one file: "Inspector.py". Here, you cannot simply remove wx.NO_3D. In particular, the match is: self.categories = wx.SplitterWindow(self, -1, style=wx.NO_3D | wx.SP_3D | wx.SP_LIVE_UPDATE)
What I did was to replace "style=wx.NO_3D" with "style=wx.DEFAULT_FRAME_STYLE" (I found this default name in one of the other files; you see how there are different "styles" recognized by the program so I just chose some other style than NO_3D).
Then I just ran Boa with: "python Boa.py"
and it worked (assuming you have the module wx installed and whatever else is needed for Boa to run in the first place of course).
回答2:
Boa Constructor is a very old project which hasn't had a release (or any commits that I could see) for 7 years. It's very likely that the code was written for a much older version of wxWindows/wxPython, and that the wx.NO_3D constant has been removed/renamed in later wx releases. You can see on the project mailing list that it's essentially dead (9 messages in 2013). It's a pity, it was really very nice.
It looks like someone made a fork on BitBucket that has commits from 2012 - that might work better for you. Certainly there's a commit for the NO_3D constant specifically. It might only go to wxPython 2.8, but it seems like a better point to start from.
回答3:
try WXPython version wxPython2.8-win32-unicode-2.8.12.1-py27
回答4:
I have uninstalled wxPython 2.9.4.0, that was giving me AttributeError: 'module' object has no attribute 'NO_3D' and I have installed wxPython2.8-win32-unicode-2.8.12.1-py27. Boa Constructor works without changing anything!!!
来源:https://stackoverflow.com/questions/21304450/can-not-start-boa-constructor-successfully