问题
For some reason, when I compile my app with Pyinstaller, it gives me an error when run:
Traceback (most recent call last):
File "<string>", line 2, in <module>
AttributeError: 'module' object has no attribute 'activex'
And the top of my code (the code itself is extremely long). I've also removed a whole load of arrays at the top, which contain text for the app.
from wxPython.wx import *
from wx import *
from wx.lib.wordwrap import wordwrap
import sys, os, re
class CheatulousFrame(wxFrame):
APP_STORAGE = ""
APP_REGISTERED = False
APP_WORKING = False
## ARRAYS GO HERE
def __init__(self, parent, ID, title):
wxFrame.__init__(self, parent, ID, title, (-1, -1), wxSize(600, 300))
self.Centre()
self.Bind(EVT_CLOSE, self.quitApp)
self.getDataPath()
self.checkRegistered()
self.menuBar = wxMenuBar()
self.createMenu(self.file_menu, "File")
self.createMenu(self.conn_menu, "Connection")
if self.APP_REGISTERED:
self.createMenu(self.regt_menu, "Registration")
else:
self.createMenu(self.regf_menu, "Registration")
self.createMenu(self.devt_menu, "Dev Tools")
self.SetMenuBar(self.menuBar)
回答1:
Are you using the activex stuff from wxPython? By the way, you shouldn't import wx like this:
from wxPython.wx import *
from wx import *
The recommended way is
import wx
And then prepend everything with "wx". wxPython is HUGE and by doing it your way, you import almost everything from it, which you don't need. The "wxPython.wx" is super old, I don't know why that's even included any more. Definitely don't use that.
来源:https://stackoverflow.com/questions/6760997/pyinstaller-activex-attribute-error-with-wxpython