[Pythonmac-SIG] simple setup.py-for-Windows question

Bob Ippolito bob at redivi.com
Thu Feb 3 20:33:05 CET 2005


On Feb 3, 2005, at 14:21, Charles Hartman wrote:

> Sorry, simpleton time again! I've gotten the Mac app to build OK with 
> py2app, but now I'm trying to get my newest project ready for first 
> tests on Windows and running into a problem. My setup.py contains the 
> line
> 		data_files = ['ScansionDictionary'],
> and one of my modules contains the line
> 		self.Dict = pickle.load(open('ScansionDictionary', 'rU'))
> On Mac, this combination puts the data file inside Resources (inside 
> Contents inside my app's bundle). On Windows it puts the file in the 
> same ('dist') directory as the executable. (Is there a better, more 
> integrated way to do it on Windows?) And when I try to run the 
> executabble the pickle.load line generates this: "LookupError: no 
> codec search functions registered: can't find encoding". How do I fix 
> this?

There is no more integrated way to do it on Windows.

py2app always automatically includes unicode support (among other 
things that the python internals may want), py2exe does not make any 
such effort to reliably produce working applications on your behalf :)  
See: <http://starship.python.net/crew/theller/moin.cgi/EncodingsAgain> 
(found by googling for: "no codec search functions registered" py2exe)

> Maybe a connnected question: what is the relation between the 
> 'data_files' argument in a setup.py file (as ordained by distutils), 
> and the 'resources' option to py2app?

data_files is a distutils option, and resources is a py2app option.  
The latter is in there because it's necessary in order to specify 
resources on the command line.  They do the same thing, though.  It's 
somewhat questionable that data_files is used for that purpose at 
all... but py2exe does it, so py2app does it too.

-bob



More information about the Pythonmac-SIG mailing list