- wrote:
> Hi!
>
> I would love to have this little mystery resolved!
>
> I've written a very small test app of 3 lines:
>
> import dabo
> app = dabo.dApp()
> app.start()
>
> and have finally managed to compile it into an executable with the following
> setup.py for py2exe.
>
> import os
> import sys
> import glob
> from distutils.core import setup
> import py2exe
> import dabo.icons
>
>
> daboDir = os.path.split(dabo.__file__)[0]
>
> # Find the location of the dabo icons:
> iconDir = os.path.split(dabo.icons.__file__)[0]
> iconSubDirs = []
> def getIconSubDir(arg, dirname, fnames):
> if ".svn" not in dirname and dirname[-1] != "\\":
> icons = glob.glob(os.path.join(dirname, "*.png"))
> if icons:
> subdir = (os.path.join("resources", dirname[len(arg)+1:]), icons)
> iconSubDirs.append(subdir)
> os.path.walk(iconDir, getIconSubDir, iconDir)
>
> # locales:
> localeDir = "%s%slocale" % (daboDir, os.sep)
> locales = []
> def getLocales(arg, dirname, fnames):
> if ".svn" not in dirname and dirname[-1] != "\\":
> mo_files = tuple(glob.glob(os.path.join(dirname, "*.mo")))
> if mo_files:
> subdir = os.path.join("dabo.locale", dirname[len(arg)+1:])
> locales.append((subdir, mo_files))
> os.path.walk(localeDir, getLocales, localeDir)
>
> data_files=[("resources", glob.glob(os.path.join(iconDir, "*.ico"))),
> ("resources", glob.glob("resources/*"))]
> data_files.extend(iconSubDirs)
> data_files.extend(locales)
>
> setup(name="basicApp",
> version='0.01',
> description="Test Dabo Application",
> options={"py2exe": {
> "compressed": 1, "optimize": 2, "bundle_files": 1,
> "excludes": ["Tkconstants","Tkinter","tcl",
> "_imagingtk", "PIL._imagingtk",
> "ImageTk", "PIL.ImageTk", "FixTk", "kinterbasdb",
> "MySQLdb", 'Numeric', 'OpenGL.GL', 'OpenGL.GLUT',
> 'dbGadfly', 'email.Generator',
> 'email.Iterators', 'email.Utils', 'kinterbasdb',
> 'numarray', 'pymssql', 'pysqlite2', 'wx.BitmapFromImage'],
> "includes": ["encodings", "locale",
> "wx.gizmos","wx.lib.calendar"]}},
> zipfile=None,
> windows=[{'script':'basicApp.py'}],
> data_files=data_files
> )
>
> Now the curiosity is that I could not get the app executable to run before
> because of lines like:
> appendItems.__doc__ += _doc_additions
>
> in dSizerMixin.py, and the error was something about adding NoneType to str
>
> Commenting out all references to <function name>.__doc__ += _doc_additions in
> that file got the little app finally displaying its GUI window post
> compilation with py2exe. It looks like _doc_additions is defined at the top
> of the class to a "" and each function is documented. So what's going on?
py2exe, in one of the optimization modes, can't handle docstrings set
explicitly. Try taking out the "optimize":2 and see if it works.
Paul
_______________________________________________
Post Messages to: [email protected]
Subscription Maintenance: http://leafe.com/mailman/listinfo/dabo-users
Searchable Archives: http://leafe.com/archives/search/dabo-users
This message: http://leafe.com/archives/byMID/[EMAIL PROTECTED]