In article <[EMAIL PROTECTED]>, Christopher Barker <[EMAIL PROTECTED]> wrote:
> Russell E. Owen wrote: > > When using py2app to create an application, is there a simple way to get > > the path to the copy of python that is/will be bundled into the > > application? > > > > (I need this to copy in some matploblit data files) > > I'm pretty sure there is a standard place in an App bundle that data > files are supposed to go. It would be nice to use that place, and point > MPL to it, rather than using a path relative to the python interpreter. > With any luck, we could get the same approach to work with py2exe also. > > Both py2app and py2exe use set a "frozen" attribute in the sys module, > so you can detect at runtime it you're running inside a bundle: > > http://pythonmac.org/wiki/FAQ#head-fda52eabc4c64a21d7044d62a49319a7c85faca9 matplotlib already uses this attribute for frozen Windows executables (by looking in a very convenient-and-obvious spot for the data files). However, it does not presently do that for Mac frozen apps. However, the current matplotlib uses saner search path for its data files, so it may be irrelevant. I will also note that freezing a windows exe that uses matplotlib is famously difficult. Ironically, the same is true for a Windows exe that uses the win32 package (a package used by many or most python programs on Windows). py2app is significantly smarter than py2exe about finding the necessary files. The only hassles on Mac are: - the need to copy the data files (not a big deal, especially, apparently, with newer matplotlibs that use smarter paths) - apparently the need to explicitly specify the FileDialog module (that one caught me off guard) - also, if one really wants to be safe, one should either delete os.env["MATPLOTLIBDATA"] or set it to the correct path. -- Russell _______________________________________________ Pythonmac-SIG maillist - Pythonmac-SIG@python.org http://mail.python.org/mailman/listinfo/pythonmac-sig