problem w/ numarray & py2exe...

RJS spam at rjs.org
Tue Jul 1 02:44:30 EDT 2003


Hi all,

I can't get a py2exe compiled app to run with numarray (numarray-0.5.win32-
py2.2). 
Also wxPythonWIN32-2.3.3.1-Py22 and ActivePython-2.2.1-222.
In the sample below, commenting out "import numarray" allows the exe to 
run. Left in, I get "4.exe has generated errors" etc.

I'm going around and around and there isn't much on Google.
py2exe output is last.

With "Python 4.py" from the shell, all is well. Any ideas? Older numarray? 
Numeric?

Ray
http://rjs.org

############################### setup.py #############
from distutils.core import setup
import py2exe

setup(name="tf.4",
      scripts=["4.py"],
)

############################# 4.py code ################
from wxPython.wx import *
import numarray
import array
import operator
from random import Random


ID_STUB   = 10

ID_IMPORT_XRC   = 100
ID_PLOT         = 111
ID_TRAIN        = 122
ID_EXPORT_ONEREV= 124
ID_EXIT         = 199
ID_ABOUT        = 141

#############################  Class defs #############################

class MainFrame(wxFrame):
    def __init__(self, parent, ID, title):
        wxFrame.__init__(self, parent, ID, title, wxDefaultPosition, 
wxSize(800, 400))
        if wxPlatform == '__WXMSW__':
            self.icon = wxIcon('imagery/rotor.ico', wxBITMAP_TYPE_ICO)
            self.SetIcon(self.icon)
            self.Centre(direction = wxBOTH)

        self.CreateStatusBar()
        self.SetStatusText("Status: ready")

        ## create the menubar
        fileMenu = wxMenu()
        fileMenu.Append(ID_IMPORT_XRC, "Import &*.xrc", "Import an xrc data 
file")
        fileMenu.AppendSeparator()
        fileMenu.Append(ID_EXPORT_ONEREV, "&Export", "Export One Rev data")
        fileMenu.AppendSeparator()
        fileMenu.Append(ID_EXIT, "E&xit", "Terminate the program")

        toolsMenu = wxMenu()
        toolsMenu.Append(ID_STUB, "Color", "Change the color scheme")
        toolsMenu.AppendSeparator()
        toolsMenu.Append(ID_PLOT, "Plot", "Plot the data")
        toolsMenu.Append(ID_TRAIN, "Train", "Train on the data")

        helpMenu = wxMenu()
        helpMenu.Append(ID_STUB, "&Help", "Index and glossary")
        helpMenu.AppendSeparator()
        helpMenu.Append(ID_ABOUT, "&About", "More information about this 
program")

        menuBar = wxMenuBar()
        menuBar.Append(fileMenu, "&File");
        menuBar.Append(toolsMenu, "&Tools");
        menuBar.Append(helpMenu, "&Help");
        self.SetMenuBar(menuBar)

        EVT_MENU(self, ID_IMPORT_XRC, self.OnImportXRC)
        EVT_MENU(self, ID_PLOT, self.createPlot)
        EVT_MENU(self, ID_TRAIN, self.OnTraining)
        EVT_MENU(self, ID_EXPORT_ONEREV, self.OnExport)
        EVT_MENU(self, ID_ABOUT, self.OnAbout)
        EVT_MENU(self, ID_EXIT,  self.ExitFrame)
        
        ##### create and add notebook pages 
####################################################################
        self.nb = wxNotebook(self, -1)
        self.fontObj = wxFont(11, wxMODERN, wxNORMAL, wxNORMAL, false)

    def OnAbout(self, event):
        dlg = wxMessageDialog(self, "Welcome to\n"
                              "Turbine v.1\n",
                              "Welcome", wxOK | wxICON_INFORMATION)
        dlg.ShowModal()
        dlg.Destroy()
        self.nb.DeletePage(0)

    def ExitFrame(self, event):
        self.Close(true)


   # ----------------------------------------------------------------------
------------------
   # handlers.
   # ----------------------------------------------------------------------
------------------   

    def OnImportXRC(self, event):
        self.dataPoints = 5000
        # open the header file
        dlg = wxFileDialog (self, "Select the XRC file for import", "data", 
"", "*.xrc", wxOPEN)
        if dlg.ShowModal() == wxID_OK:
            try:
                self.filePath = dlg.GetPath()
            except IOError:
                dlg_m = wxMessageDialog (self,
                                        'There was an error opening the new 
xrc file.',
                                        'Error!', wxOK)
                dlg_m.ShowModal()
                dlg_m.Destroy() 
        dlg.Destroy()

    def createDataArray(self):
        # create the XRC tabs
        self.nb.xrcHeader = wxTextCtrl(self.nb, -1, "",wxPoint(0, 0), 
wxSize(75, 20), wxTE_MULTILINE|wxTE_RICH )
        self.nb.xrcHeader.SetStyle(0, self.nb.xrcHeader.GetLastPosition(), 
wxTextAttr("BLACK", wxNullColour, self.fontObj))
        self.nb.AddPage(self.nb.xrcHeader, "XRC Header: "+self.filePath)
        self.nb.xrcHeader.LoadFile(self.filePath)

    def createPlot(self, event=NULL):     
        plotWidthPoints = 5000

    def OnExport(self, event):
        self.nb.SetSelection(1)

    def OnTraining(self, event=NULL):
        firstSet = TRUE                


    def createOneRevPlot(self, pointsPerRev, revs):     
        plotWidthPoints = int(pointsPerRev)
        self.nb.AdvanceSelection()

    def OnExport(self, event):
        self.nb.SetSelection(3)
        
    def histogram(self,a, bins):
        return 1

############### Main application class ###########
class App(wxApp):
    def OnInit(self):
        frame = MainFrame(NULL, -1, "Turbine ")
        frame.Show(true)
        self.SetTopWindow(frame)
        return true


app = App(0)
app.MainLoop()









################# py2exe output #####################
D:\projects\fingerprinting>python setup.py py2exe
running py2exe
running build
running build_scripts
not copying 4.py (up-to-date)
running install_scripts
creating build\bdist.win32\winexe
creating build\bdist.win32\winexe\lib
creating build\bdist.win32\winexe\lib\Python
creating build\bdist.win32\winexe\lib\Python\Scripts
copying build\scripts-2.2\4.py -> 
build\bdist.win32\winexe\lib\Python\Scripts
copying build\scripts-2.2\tf.4.py -> 
build\bdist.win32\winexe\lib\Python\Scripts

copying build\scripts-2.2\tf.5.py -> 
build\bdist.win32\winexe\lib\Python\Scripts

+----------------------------------------------------
| Processing script 4.py with py2exe-0.3.4
+----------------------------------------------------
creating build\bdist.win32\winexe\collect
creating build\bdist.win32\winexe\collect\4
creating build\bdist.win32\winexe\collect\4\Scripts.py2exe
Searching modules needed to run '4.py' on path:
['D:\\projects\\fingerprinting\\build\\bdist.win32\\winexe\\lib\\Python\\Li
b\\si
te-packages', '', 'D:\\Python\\Lib\\site-packages\\Pythonwin', 
'D:\\Python\\Lib\
\site-packages\\win32', 'D:\\Python\\Lib\\site-packages\\win32\\lib', 
'D:\\Pytho
n\\Lib\\site-packages', 'D:\\Python\\DLLs', 'D:\\Python\\lib', 
'D:\\Python\\lib\
\lib-tk', 'D:\\Python', 'D:\\Python\\lib\\site-packages\\numarray']
force_imports =
Resolving binary dependencies:
  D:\Python\lib\site-packages\numarray\_numarray.pyd
  D:\Python\lib\site-packages\numarray\_operator.pyd
  D:\Python\Lib\site-packages\py2exe\run.exe
  D:\Python\Lib\site-packages\wxPython\utilsc.pyd
  D:\Python\lib\site-packages\numarray\_conv.pyd
  D:\Python\lib\site-packages\numarray\_bytes.pyd
  D:\Python\lib\site-packages\numarray\_ufunc.pyd
  D:\Python\lib\site-packages\numarray\_converter.pyd
  D:\Python\Lib\site-packages\wxPython\wxmsw233h.dll
  D:\Python\Lib\site-packages\wxPython\wxc.pyd
  C:\WIN2000\System32\python22.dll
  D:\Python\lib\site-packages\numarray\_ndarray.pyd
  D:\Python\lib\site-packages\numarray\memory.pyd
  D:\Python\lib\site-packages\numarray\_sort.pyd
  D:\Python\Lib\site-packages\wxPython\wxmsw232h.dll
  D:\Python\DLLs\_sre.pyd
ext_mapping = {
 '_conv': ('_conv.pyd', ('.pyd', 'rb', 3))
 '_ndarray': ('_ndarray.pyd', ('.pyd', 'rb', 3))
 '_sort': ('_sort.pyd', ('.pyd', 'rb', 3))
 '_converter': ('_converter.pyd', ('.pyd', 'rb', 3))
 '_numarray': ('_numarray.pyd', ('.pyd', 'rb', 3))
 '_ufunc': ('_ufunc.pyd', ('.pyd', 'rb', 3))
 '_operator': ('_operator.pyd', ('.pyd', 'rb', 3))
 '_bytes': ('_bytes.pyd', ('.pyd', 'rb', 3))
 'memory': ('memory.pyd', ('.pyd', 'rb', 3))
 'wxPython.utilsc': ('utilsc.pyd', ('.pyd', 'rb', 3))
 '_sre': ('_sre.pyd', ('.pyd', 'rb', 3))
 'wxPython.wxc': ('wxc.pyd', ('.pyd', 'rb', 3))
}
copying D:\Python\Lib\site-packages\py2exe\support.py -> 
build\bdist.win32\winex
e\collect\4\Scripts.py2exe
byte-compiling D:\Python\lib\pre.py to pre.pyc
byte-compiling D:\Python\lib\__future__.py to __future__.pyc
byte-compiling D:\Python\lib\copy_reg.py to copy_reg.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\fonts.py to 
wxPython\fonts.p
yc
byte-compiling D:\Python\Lib\site-packages\wxPython\windows.py to 
wxPython\windo
ws.pyc
byte-compiling D:\Python\lib\locale.py to locale.pyc
byte-compiling D:\Python\lib\random.py to random.pyc
byte-compiling D:\Python\lib\popen2.py to popen2.pyc
byte-compiling D:\Python\lib\stat.py to stat.pyc
byte-compiling D:\Python\lib\imputil.py to imputil.pyc
byte-compiling D:\Python\lib\site-packages\numarray\_ufuncall.py to 
_ufuncall.py
c
byte-compiling D:\Python\Lib\site-packages\wxPython\events.py to 
wxPython\events
.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\utils.py to 
wxPython\utils.p
yc
byte-compiling D:\Python\lib\site-packages\numarray\arrayprint.py to 
arrayprint.
pyc
byte-compiling D:\Python\lib\string.py to string.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\printfw.py to 
wxPython\print
fw.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\misc.py to 
wxPython\misc.pyc

byte-compiling D:\Python\lib\re.py to re.pyc
byte-compiling D:\Python\lib\tempfile.py to tempfile.pyc
byte-compiling D:\Python\lib\warnings.py to warnings.pyc
byte-compiling D:\Python\lib\site-packages\numarray\typeconv.py to 
typeconv.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\streams.py to 
wxPython\strea
ms.pyc
byte-compiling D:\Python\lib\sre_constants.py to sre_constants.pyc
byte-compiling D:\Python\lib\ntpath.py to ntpath.pyc
byte-compiling D:\Python\lib\sre_compile.py to sre_compile.pyc
byte-compiling D:\Python\lib\getopt.py to getopt.pyc
byte-compiling D:\Python\lib\site-packages\numarray\ufunc.py to ufunc.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\controls2.py to 
wxPython\con
trols2.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\windows3.py to 
wxPython\wind
ows3.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\stattool.py to 
wxPython\stat
tool.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\controls.py to 
wxPython\cont
rols.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\__version__.py to 
wxPython\_
_version__.pyc
byte-compiling D:\Python\lib\UserDict.py to UserDict.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\wx.py to 
wxPython\wx.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\sizers.py to 
wxPython\sizers
.pyc
byte-compiling D:\Python\lib\repr.py to repr.pyc
byte-compiling D:\Python\lib\sre_parse.py to sre_parse.pyc
byte-compiling D:\Python\lib\copy.py to copy.pyc
byte-compiling D:\Python\lib\site-packages\numarray\numerictypes.py to 
numericty
pes.pyc
byte-compiling D:\Python\lib\types.py to types.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\filesys.py to 
wxPython\files
ys.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\windows2.py to 
wxPython\wind
ows2.pyc
byte-compiling D:\Python\lib\dospath.py to dospath.pyc
byte-compiling D:\Python\lib\sre.py to sre.pyc
byte-compiling D:\Python\lib\site-packages\numarray\numarray.py to 
numarray.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\misc2.py to 
wxPython\misc2.p
yc
byte-compiling D:\Python\lib\site-packages\numarray\ndarray.py to 
ndarray.pyc
byte-compiling D:\Python\lib\linecache.py to linecache.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\frames.py to 
wxPython\frames
.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\__init__.py to 
wxPython\__in
it__.pyc
byte-compiling D:\Python\lib\posixpath.py to posixpath.pyc
byte-compiling D:\Python\lib\site-packages\numarray\numinclude.py to 
numinclude.
pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\cmndlgs.py to 
wxPython\cmndl
gs.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\image.py to 
wxPython\image.p
yc
byte-compiling D:\Python\Lib\site-packages\wxPython\mdi.py to 
wxPython\mdi.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\gdi.py to 
wxPython\gdi.pyc
byte-compiling D:\Python\lib\os.py to os.pyc
byte-compiling D:\Python\Lib\site-packages\wxPython\clip_dnd.py to 
wxPython\clip
_dnd.pyc
copying 4.py -> 
build\bdist.win32\winexe\collect\4\Scripts.py2exe\__main__.py
changing into 'build\bdist.win32\winexe\collect\4'
zip -rq D:\projects\fingerprinting\build\bdist.win32\winexe\4.zip .
creating 'D:\projects\fingerprinting\build\bdist.win32\winexe\4.zip' and 
adding
'.' to it
changing back to 'D:\projects\fingerprinting'
creating dist\4\4.exe
warning: py2exe: could not parse version number ''
  No VersionInfo will be created
not copying D:\Python\lib\site-packages\numarray\_numarray.pyd (output up-
to-dat
e)
not copying D:\Python\lib\site-packages\numarray\_operator.pyd (output up-
to-dat
e)
not copying D:\Python\Lib\site-packages\wxPython\utilsc.pyd (output up-to-
date)
not copying D:\Python\lib\site-packages\numarray\_conv.pyd (output up-to-
date)
not copying D:\Python\lib\site-packages\numarray\_bytes.pyd (output up-to-
date)
not copying D:\Python\lib\site-packages\numarray\_ufunc.pyd (output up-to-
date)
not copying D:\Python\lib\site-packages\numarray\_converter.pyd (output up-
to-da
te)
not copying D:\Python\Lib\site-packages\wxPython\wxmsw233h.dll (output up-
to-dat
e)
not copying D:\Python\Lib\site-packages\wxPython\wxc.pyd (output up-to-
date)
not copying C:\WIN2000\System32\python22.dll (output up-to-date)
not copying D:\Python\lib\site-packages\numarray\_ndarray.pyd (output up-
to-date
)
not copying D:\Python\lib\site-packages\numarray\memory.pyd (output up-to-
date)
not copying D:\Python\lib\site-packages\numarray\_sort.pyd (output up-to-
date)
not copying D:\Python\Lib\site-packages\wxPython\wxmsw232h.dll (output up-
to-dat
e)
not copying D:\Python\DLLs\_sre.pyd (output up-to-date)
warning: py2exe: 
***************************************************************
**********
warning: py2exe: * The following modules were not found:
warning: py2exe: *   cmndlgsc
warning: py2exe: *   imagec
warning: py2exe: *   clip_dndc
warning: py2exe: *   windows3c
warning: py2exe: *   filesysc
warning: py2exe: *   eventsc
warning: py2exe: *   windows2c
warning: py2exe: *   controlsc
warning: py2exe: *   misc2c
warning: py2exe: *   os.path
warning: py2exe: *   windowsc
warning: py2exe: *   stattoolc
warning: py2exe: *   printfwc
warning: py2exe: *   gdic
warning: py2exe: *   sizersc
warning: py2exe: *   mdic
warning: py2exe: *   fontsc
warning: py2exe: *   streamsc
warning: py2exe: *   miscc
warning: py2exe: *   controls2c
warning: py2exe: *   framesc
warning: py2exe: 
***************************************************************
**********
removing 'build\bdist.win32\winexe\collect\4' (and everything under it)
Built File dist\4\4.exe
removing 'build\bdist.win32\winexe' (and everything under it)




More information about the Python-list mailing list