Success! Adding the line :-
   ("biz", glob.glob("biz/*")),
to the data files did the job. I will now try to work out how to convert 
that to an includes directive (unfortunately I have no examples, so I'll 
have to go digging).
    As an aside. For development purposes I like the dabo folder structure - 
but it does become a bit of a pain in this type of situation. Given that it 
is pretty standard in the dabo world has anyone developed a template for a 
py2exe setup script for this standard development structure? If not, when I 
have got it working right perhaps I should add it to the wiki - just 
suprised if no-one has done it before.
                     Rodgy

----- Original Message ----- 
From: "Roger Lovelock" <[EMAIL PROTECTED]>
To: "Dabo Users list" <[email protected]>
Sent: Wednesday, December 03, 2008 1:15 PM
Subject: Re: [dabo-users] py2exe


> Tried getting the script to copy across the code file as a data file 
> without success - so I tried Eds idea of a single code/cdxml file. That 
> seemed to work, but showed then that my bizObj file was not being copied 
> (I got errors saying there was no such bizObj nb code works fine running 
> from python) - I have tried to get the setup script to copy that file 
> across (see new version below), but without success - the biz folder is 
> not even created! I suspect I simply have a basic syntax error in the 
> script, but have tried all sorts of possibilities without success. Some 
> other eyes I'm sure will see it where I am missing it.  Please ....
>
> #!/usr/bin/env python
> # -*- coding: utf-8 -*-
>
> import os
> import sys
> import glob
> from distutils.core import setup
> import py2exe
> import dabo
> import dabo.icons
>
> dabo.ui.loadUI("wx")
>
>
> 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 = [("dabo.locale", (os.path.join(daboDir, "locale", 
> "dabo.pot"),))]
> locales = []
> def getLocales(arg, dirname, fnames):
>  if ".svn" not in dirname and dirname[-1] != "\\":
>    #po_files = tuple(glob.glob(os.path.join(dirname, "*.po")))
>    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)
>
>
>
> # Set your app icon here:
> _appIcon = None
> #_appIcon = "./resources/stock_addressbook.ico"
>
> _script = "membershipTypes.py"
>
>
> class Target:
> def __init__(self, **kw):
>  self.__dict__.update(kw)
>  self.script=_script
>  self.other_resources=[]
>  if _appIcon is not None:
>   self.icon_resources=[(1, _appIcon)]
>
>
> data_files=[(".", ("LodgeBooks.db3",)),
>  (".", ("membershipTypes.exe.manifest",)),
>  ("db", ["db/LodgeBooks.cnxml"]),
>  ("biz", ["biz/MembershiptypesBizobj.py"]),
>  ("ui", ["ui/membershipTypes.cdxml"]),
>  ("resources", glob.glob(os.path.join(iconDir, "*.ico"))),
>  ("resources", glob.glob("resources/*")),
>  ("reports", glob.glob("reports/*"))]
> data_files.extend(iconSubDirs)
> data_files.extend(locales)
>
> import py2exe
> setup(name=_script,
>  options={"py2exe": {"packages": ["wx.gizmos", "wx.lib.calendar"],
>    "optimize": 2,
>    "excludes": ["Tkconstants","Tkinter","tcl",
>    "_imagingtk", "PIL._imagingtk",
>    "ImageTk", "PIL.ImageTk", "FixTk"]}},
>  packages=["ui", "biz", "db"],
>  zipfile=None,
>  windows=[Target()],
>  data_files=data_files
> )
>
>
>
> ----- Original Message ----- 
> From: "Paul McNett" <[EMAIL PROTECTED]>
> To: "Dabo Users list" <[email protected]>
> Sent: Wednesday, December 03, 2008 1:38 AM
> Subject: Re: [dabo-users] py2exe
>
>
>> Roger Lovelock wrote:
>>> Have been trying to get a py2exe script together for a ClassDesigner 
>>> generated app (the one generated by the AppWizard version of my program 
>>> is working fine).
>>> I have modified the AppWizard generated script  (see below), but while 
>>> it generates my screen OK no data is loaded and the buttons (in 
>>> particular the close button) do not work. I suspect that this is because 
>>> the membershipTypes-code.py (ie screen related code)  routine in ui is 
>>> not being picked up by py2exe (as this routine contains the navigation 
>>> and bizObj code).
>>>     Maybe there is something simple missing from my setup script. Can 
>>> anyone help?
>>
>> First, figure out if the file is included or not. The .exe is a zip file 
>> that you can
>> expand into its constituent files. The dist directory contains all your 
>> "data files".
>> If you don't find that code.py file anywhere, then you need to help 
>> py2exe to include it.
>>
>> First, and this is probably "wrong" (because code files aren't data, and 
>> should be
>> compiled first instead of placed in the app bundle in plain text) but 
>> easiest to get
>> working: add it to the data_files directive, following the other 
>> examples.
>>
>> If that works, then next try the "includes" directive.
>>
>> Use the file globbing like is shown in the AppWizard example.
>>
>> Paul
>>
>>
> http://leafe.com/archives/byMID/[EMAIL PROTECTED] 



_______________________________________________
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]

Reply via email to