From: Stephen E. <py...@re...> - 2010-10-06 09:41:45
|
Ali, On 05/10/2010 22:33, ali vakilzade wrote: > every time I want to execute my output file it returns this error. > > ERROR:root:Project path not found. "---\dist\library.zip\data" > > I have added the 'data' folder in setup.py in this line > > data_files = [ > ('data', glob.glob('data/*') )] > > I don't know what is the problem. I'm completely confused > > when i use 'C:\Python26\python my.py' > I can run my app and there is no error (I mean i'm sure my app can > work on window) > but py2exe returns that error. > > windows xp - sp2 The path of a data file may differ if the script has been compiled into an executable. This is the code that I use to find "filename" in the data folder: def datapath(filename): if hasattr(sys, 'frozen') and sys.frozen == 'windows_exe': root = os.path.dirname(os.path.abspath(sys.executable)) else: root = os.path.dirname(__file__) return os.path.join(root, 'data', filename) (Python 2.6 and XP SP3) Stephen |