Thanks for the tip. This is what I got back from Python: *>>> import pandas.rpy.common as com* *>>> import pandas.io.sql as psql* *>>> import rpy2.robjects as robjects* *>>> print com.__file__, '\n', psql.__file__, '\n', robjects.__file__* * /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/rpy/common.pyc * * /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/io/sql.pyc * * /Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rpy2-2.3.6-py2.7-macosx-10.6-intel.egg/rpy2/robjects/__init__.pyc *
So I modified my spec file as this: *# -*- mode: python -*-* *a = Analysis(['/Users/boxuancui/Documents/AA/Scripts/task.py'],* * pathex=['/Users/boxuancui/Documents/AA/Final_app',* * '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages', * *# '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/rpy', * *# '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/pandas-0.11.0-py2.7-macosx-10.6-intel.egg/pandas/io', * *# '/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/rpy2-2.3.6-py2.7-macosx-10.6-intel.egg/rpy2/robjects'], * * hiddenimports=[],* * hookspath=None,* * runtime_hooks=None)* *pyz = PYZ(a.pure)* * * *exe = EXE(pyz,* * a.scripts,* * exclude_binaries=True,* * name='MyApp',* * debug=False,* * strip=None,* * upx=True,* * console=False , icon='/Users/boxuancui/Documents/AA/Mac.icns')* * * *coll = COLLECT(exe,* * a.binaries,* * a.zipfiles,* * a.datas,* * strip=None,* * upx=True,* * name='**MyApp**')* * * *app = BUNDLE(coll,* * name='**MyApp**.app',* * icon='/Users/boxuancui/Documents/AA/Mac.icns',* * version=1.0)* You noticed the commented code in *pathex*. I tried to build with and without them. The app still crashes. Again, I am pretty sure these 3 imports are creating problems, because the app could be opened without these 3 imports. On Friday, June 28, 2013 12:22:43 AM UTC-4, Steve Barnes wrote: > > On 27/06/13 22:33, Boxuan Cui wrote: > > I deleted my previous post. The app won't crash, but it did not work as > intended. > > I took a closer look and found that modules like *pandas.io.sql*, * > rpy2.objects*, *pandas.rpy.common* do not exist at all. As a result, > PyInstaller could not find them. However, if I do *import pandas.io.sql > as psql*, *import rpy2.objects as robjects* and *import pandas.rpy.common > as com*, it works. Why is this so? > > > > Don't forget that there may be a module/package pandas.io that contains > an object called sql or even one called pandas that contains an object io > that has a member called sql and just to add to the confusion there can be > some renaming/aliasing so for example the pandas.io package could from > pandas.os.whatever.sqlstuff import stuff as sql, etc. This sort of thing > is especailly common when a package author has to deal with platform > specific items. I have some in some of my code and pyinstaller & py2exe > both have trouble unless I explicitly tell them to include the "real" > package(s) or in cases where I am having to programmatically generate > imports I can twist their arm by having somewhere in my code imports of all > the possible results behind an if False: clause. > > You should be able to get a clue by adding to your code, after the > imports, above: > print psql.__file__ > print robjects.__file__ > etc. > > <snip> > > Gadget/Steve > -- You received this message because you are subscribed to the Google Groups "PyInstaller" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. To post to this group, send email to [email protected]. Visit this group at http://groups.google.com/group/pyinstaller. For more options, visit https://groups.google.com/groups/opt_out.
