From: Jeff P. <jef...@se...> - 2005-09-16 16:14:48
|
#!/usr/bin/env python #Boa:App:BoaApp import wx import Frame1 modules ={'Frame1': [1, 'Main frame of Application', 'Frame1.py']} class BoaApp(wx.App): def OnInit(self): wx.InitAllImageHandlers() self.main = Frame1.create(None) self.main.Show() self.SetTopWindow(self.main) return True def main(): application = BoaApp(0) application.MainLoop() if __name__ == '__main__': main() |
From: Archana G. <arc...@gm...> - 2007-03-31 06:20:10
|
Hi all, I have a python application that uses matplotlib. I want to compile it into an executable. I tried using py2exe but it returned some error w.rtmatplotlib. Cpuld anyone please help me with this? Is there some other way to get it done? Thanks, Archana |
From: Werner F. B. <wer...@fr...> - 2007-03-31 15:28:30
Attachments:
setup.py
embedding_in_wx4.py
|
Hi Archana, Archana Ganesan wrote: > Hi all, > > I have a python application that uses matplotlib. I want to compile it > into an executable. I tried using py2exe but it returned some error > w.rt matplotlib. Cpuld anyone please help me with this? Is there some > other way to get it done? I am using matplotlib (currently 0.90) with wxPython and py2exe (0.6.6). Attached are some sample files. I am on: # Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit (Intel)] # wxPython 2.8.1.1, Boa Constructor 0.5.2 And as I am still using wxPython Ansi I renamed matplotlib/backends/_wxagg.pyd to matplotlib/backends/_wxagg not used.pyd Hope this helps Werner |
From: Archana G. <arc...@gm...> - 2007-03-31 19:50:32
|
Hi all, I have a python application that uses matplotlib.I am trying to compile it into an executable using py2exe. I am encountering "No module named num_array problem". I do not know how to resolve this. I notice that " matplotlib.numerix" is in the included package. Did you encounter this problem. I am very new to this and I have to get it done by tomm. So I am sorry if it is really silly. Thanks, Archana. On 3/31/07, Archana Ganesan <arc...@gm...> wrote: > > Hi all, > > I have a python application that uses matplotlib. I want to compile it > into an executable. I tried using py2exe but it returned some error w.rtmatplotlib. Cpuld anyone please help me with this? Is there some other way > to get it done? > > Thanks, > Archana > |
From: Tommy G. <tg...@ma...> - 2007-03-31 20:17:36
|
It is hard to guess what exactly your problem is as you do not provide a code example or the traceback call of your exception. I would venture that you are trying to create a num_array without having Numerix, numpy or numarray imported or installed on your machine. Some more information about your troubles would be needed to really help you out. Cheers Tommy On Mar 31, 2007, at 3:50 PM, Archana Ganesan wrote: > Hi all, > I have a python application that uses matplotlib.I am trying to > compile it into an executable using py2exe. I am encountering "No > module named num_array problem". I do not know how to resolve > this. I notice that "matplotlib.numerix" is in the included > package. Did you encounter this problem. I am very new to this and > I have to get it done by tomm. So I am sorry if it is really silly. > > Thanks, > > Archana. > > > On 3/31/07, Archana Ganesan < arc...@gm...> wrote: > Hi all, > > I have a python application that uses matplotlib. I want to compile > it into an executable. I tried using py2exe but it returned some > error w.rt matplotlib. Cpuld anyone please help me with this? Is > there some other way to get it done? > > Thanks, > Archana > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV________________________________ > _______________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users |
From: Archana G. <arc...@gm...> - 2007-03-31 20:26:37
|
Hi all, The exception I get is Traceback (most recent call last): File "App1.py", line 6, in ? File "Frame1.pyc", line 9, in ? File "Simulation.pyc", line 16, in ? File "pylab.pyc", line 1, in ? File "matplotlib\pylab.pyc", line 199, in ? File "matplotlib\cm.pyc", line 5, in ? File "matplotlib\colors.pyc", line 33, in ? File "matplotlib\numerix\__init__.pyc", line 147, in ? ImportError: No module named random_array I have numpy installed in site-packages. The setup.py that I am using is as follows: Thanks, Archana. from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", ## "kinterbasdb", "pytz.zoneinfo.UTC", #"matplotlib.numerix", ## "email", ##"numpy" ## "PIL", ], "excludes": ["MySQLdb", "Tkconstants", "Tkinter", "tcl", "orm.adapters.pgsql", "orm.adapters.mysql" ], "dll_excludes": ["tcl84.dll", "tk84.dll", "wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], # windows = [wx_emb], #console = [twcb], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), matplotlib.get_py2exe_datafiles() # if you don't use the lib option #### ("prog\\amaradata", amaradata), #### ("prog\\amaradata\\Schemata", amaraschemata), #### ("prog\\", python4dll) ] ) On 3/31/07, Tommy Grav <tg...@ma...> wrote: > > It is hard to guess what exactly your problem is as you do not provide a > code > example or the traceback call of your exception. I would venture that you > are > trying to create a num_array without having Numerix, numpy or numarray > imported > or installed on your machine. > > Some more information about your troubles would be needed to really help > you out. > > Cheers > Tommy > > > On Mar 31, 2007, at 3:50 PM, Archana Ganesan wrote: > > Hi all, > I have a python application that uses matplotlib.I am trying to compile it > into an executable using py2exe. I am encountering "No module named > num_array problem". I do not know how to resolve this. I notice that " > matplotlib.numerix" is in the included package. Did you encounter this > problem. I am very new to this and I have to get it done by tomm. So I am > sorry if it is really silly. > > Thanks, > > Archana. > > > On 3/31/07, Archana Ganesan < arc...@gm...> wrote: > > > > Hi all, > > > > I have a python application that uses matplotlib. I want to compile it > > into an executable. I tried using py2exe but it returned some error w.rtmatplotlib. Cpuld anyone please help me with this? Is there some other way > > to get it done? > > > > Thanks, > > Archana > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Robert K. <rob...@gm...> - 2007-03-31 23:56:23
|
Archana Ganesan wrote: > Hi all, > > The exception I get is > Traceback (most recent call last): > File "App1.py", line 6, in ? > File "Frame1.pyc", line 9, in ? > File "Simulation.pyc", line 16, in ? > File "pylab.pyc", line 1, in ? > File "matplotlib\pylab.pyc", line 199, in ? > File "matplotlib\cm.pyc", line 5, in ? > File "matplotlib\colors.pyc", line 33, in ? > File "matplotlib\numerix\__init__.pyc", line 147, in ? > ImportError: No module named random_array Did you follow these instructions? http://www.py2exe.org/index.cgi/MatPlotLib -- Robert Kern "I have come to believe that the whole world is an enigma, a harmless enigma that is made terrible by our own mad attempt to interpret it as though it had an underlying truth." -- Umberto Eco |
From: Werner F. B. <wer...@fr...> - 2007-04-01 08:16:18
|
Hi Archana, Sometimes py2exe can't figure out what needs to be included. In these cases one creates entries in the packages section to force the inclusion of one or multiple packages. Archana Ganesan wrote: > Hi all, > ... > > options = {"py2exe": {"compressed": 1, > "optimize": 2, > "packages": ["encodings", > ## "kinterbasdb", > "pytz.zoneinfo.UTC", > #" matplotlib.numerix", > You need to activate/un-comment the matplotlib.numerix line. Also note that if you only include UTC and you use the timezone stuff in matplot then a user NOT using UTC, i.e. another timezone will have a problem, it is therefore better to just include all of pytz. Werner |
From: Archana G. <arc...@gm...> - 2007-04-01 17:06:40
|
Hi, I tried following the instructions at the py2exe site and I have also uncommeneted and made it include the matplotlib.numerix package. Still it doesnt seem to work. Is there any other way of compiling it into an executable? Thanks, Archana. On 4/1/07, Werner F. Bruhin <wer...@fr...> wrote: > > Hi Archana, > > Sometimes py2exe can't figure out what needs to be included. In these > cases one creates entries in the packages section to force the inclusion > of one or multiple packages. > > Archana Ganesan wrote: > > Hi all, > > ... > > > > options = {"py2exe": {"compressed": 1, > > "optimize": 2, > > "packages": ["encodings", > > ## "kinterbasdb", > > "pytz.zoneinfo.UTC", > > #" matplotlib.numerix", > > > > You need to activate/un-comment the matplotlib.numerix line. Also note > that if you only include UTC and you use the timezone stuff in matplot > then a user NOT using UTC, i.e. another timezone will have a problem, it > is therefore better to just include all of pytz. > > Werner > |
From: Werner F. B. <wer...@fr...> - 2007-04-04 04:22:06
|
Hi Giorgio, Giorgio Luciano wrote: > Hello Werner, > here is the file I try to compile. > It gave an error of missing DLL when i try to launch :( > no Idea why, since with you example everything works > (I'm using maplotlib 0.87.7) I assume the DLL not found is "wxmsw26uh_vc.dll" at least I believe that 87.7 is already compiled against wxPython 2.6 Unicode (hopefully this dependency will go away with some future release of matplotlib), so you need to either use the Unicode version of wxPython 2.6 or do the following as mentioned earlier in this thread. matplotlib/backends/_wxagg.pyd to matplotlib/backends/_wxagg not used.pyd If it is another .dll missing it would help if you let us know the name and the exact exception. Werner |
From: Werner F. B. <wer...@fr...> - 2007-04-04 09:30:45
|
Hi Giorgio, Giorgio Luciano wrote: > Hello Werner, > and thank for the reply I've tried to recompile everything. The file > you sent in the mailing list give me the problem of wxmsw26uh_vc.dll > (and also dll missing while compiling) For the wxmsw26uh_vc.dll you need to rename the .pyd file as mentioned in the response to Daniel before you py2exe it. The error output you get when running py2exe is normal, it just tells you that there are files not included by py2exe. You need to decide if you need them, if you have the right to distribute them etc and then either include them with your installer or add them to the package include option for py2exe. > but then it runs > when I try to compile my file (nipals) it doesnt' start and give me as > error Sorry, I don't understand why you get the error about backends, but I can't run your nipals.py as it contains/uses modules I don't have. I'll see if I can do a setup.py for a simple matplotlib file using pylab. Werner |
From: Tommy G. <tg...@ma...> - 2007-03-31 23:12:35
|
I do not immediately see why the error occurs. Hopefully someone else can add their input. Off the cuff it seems like matplotlib has not been installed properly. Can you confirm that import numpy and import matplotlib works in the interactive python shell. Cheers Tommy [tgrav@Thrym] /Users/tgrav --> python Python 2.4.4 (#1, Oct 18 2006, 10:34:39) [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin Type "help", "copyright", "credits" or "license" for more information. >>> import numpy >>> import matplotlib >>> from matplotlib.numerix import * >>> random_array <module 'matplotlib.numerix.random_array' from '/Library/Frameworks/ Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/ numerix/random_array/__init__.pyc'> >>> numpy.__version__ '1.0.1.dev3436' >>> matplotlib.__version__ '0.87.7' >>> so random_array works fine in my version On Mar 31, 2007, at 4:26 PM, Archana Ganesan wrote: > Hi all, > > The exception I get is > Traceback (most recent call last): > File "App1.py", line 6, in ? > File "Frame1.pyc", line 9, in ? > File "Simulation.pyc", line 16, in ? > File "pylab.pyc", line 1, in ? > File "matplotlib\pylab.pyc", line 199, in ? > File "matplotlib\cm.pyc", line 5, in ? > File "matplotlib\colors.pyc", line 33, in ? > File "matplotlib\numerix\__init__.pyc", line 147, in ? > ImportError: No module named random_array > > I have numpy installed in site-packages. The setup.py that I am > using is as follows: > > Thanks, > Archana. > > > from distutils.core import setup > import os > from os.path import join > import shutil > > import glob > import py2exe > from py2exe.build_exe import py2exe > import sys > > import matplotlib > mpdir, mpfiles = matplotlib.get_py2exe_datafiles() > > # cleanup dist and build directory first (for new py2exe version) > if os.path.exists("dist/prog"): > shutil.rmtree("dist/prog") > > if os.path.exists("dist/lib"): > shutil.rmtree ("dist/lib") > > if os.path.exists("build"): > shutil.rmtree("build") > > options = {"py2exe": {"compressed": 1, > "optimize": 2, > "packages": ["encodings", > ## "kinterbasdb", > "pytz.zoneinfo.UTC", > #" matplotlib.numerix", > > ## "email", > ##"numpy" > ## "PIL", > ], > "excludes": ["MySQLdb", "Tkconstants", > "Tkinter", "tcl", > "orm.adapters.pgsql ", > "orm.adapters.mysql" > ], > "dll_excludes": ["tcl84.dll", "tk84.dll", > "wxmsw26uh_vc.dll"] > } > } > zipfile = r"lib\library.zip" > > setup( > classifiers = ["Copyright:: your name", > "Development Status :: 5 Stable", > "Intended Audience :: End User", > "License :: Shareware", > "Operating System :: Microsoft :: Windows 2000", > "Operating System :: Microsoft :: Windows XP", > "Operating System :: Microsoft :: Windows 9x", > "Programming Language :: Python, wxPython", > "Topic :: Home Use" > "Natural Language :: German", > "Natural Language :: French", > "Natural Language :: English"], > # windows = [wx_emb], > #console = [twcb], > options = options, > zipfile = zipfile, > data_files = [("lib\\matplotlibdata", mpfiles), > matplotlib.get_py2exe_datafiles() # if you > don't use the lib option > #### ("prog\\amaradata", amaradata), > #### ("prog\\amaradata\\Schemata", amaraschemata), > #### ("prog\\", python4dll) > ] > ) > > > On 3/31/07, Tommy Grav <tg...@ma...> wrote: > It is hard to guess what exactly your problem is as you do not > provide a code > example or the traceback call of your exception. I would venture > that you are > trying to create a num_array without having Numerix, numpy or > numarray imported > or installed on your machine. > > Some more information about your troubles would be needed to really > help you out. > > Cheers > Tommy > > > On Mar 31, 2007, at 3:50 PM, Archana Ganesan wrote: > >> Hi all, >> I have a python application that uses matplotlib.I am trying to >> compile it into an executable using py2exe. I am encountering "No >> module named num_array problem". I do not know how to resolve >> this. I notice that " matplotlib.numerix" is in the included >> package. Did you encounter this problem. I am very new to this and >> I have to get it done by tomm. So I am sorry if it is really silly. >> >> Thanks, >> >> Archana. >> >> >> On 3/31/07, Archana Ganesan < arc...@gm... > wrote: >> Hi all, >> >> I have a python application that uses matplotlib. I want to >> compile it into an executable. I tried using py2exe but it >> returned some error w.rt matplotlib. Cpuld anyone please help me >> with this? Is there some other way to get it done? >> >> Thanks, >> Archana >> >> --------------------------------------------------------------------- >> ---- >> Take Surveys. Earn Cash. Influence the Future of IT >> Join SourceForge.net's Techsay panel and you'll get the chance to >> share your >> opinions on IT & business topics through brief surveys-and earn cash >> http://www.techsay.com/default.php? >> page=join.php&p=sourceforge&CID=DEVDEV_______________________________ >> ________________ >> Matplotlib-users mailing list >> Mat...@li... >> https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > ---------------------------------------------------------------------- > --- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to > share your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php? > page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Archana G. <arc...@gm...> - 2007-03-31 23:52:29
|
import numpy and import matplotlib does work in the interactive python shell. thanks, Archana. On 3/31/07, Tommy Grav <tg...@ma...> wrote: > > I do not immediately see why the error occurs. Hopefully someone else > can add their input. Off the cuff it seems like matplotlib has not been > installed properly. Can you confirm that import numpy and import > matplotlib works in the interactive python shell. > > Cheers > Tommy > > [tgrav@Thrym] /Users/tgrav --> python > Python 2.4.4 (#1, Oct 18 2006, 10:34:39) > [GCC 4.0.1 (Apple Computer, Inc. build 5341)] on darwin > Type "help", "copyright", "credits" or "license" for more information. > >>> import numpy > >>> import matplotlib > >>> from matplotlib.numerix import * > >>> random_array > <module 'matplotlib.numerix.random_array' from > '/Library/Frameworks/Python.framework/Versions/2.4/lib/python2.4/site-packages/matplotlib/numerix/random_array/__init__.pyc'> > >>> numpy.__version__ > '1.0.1.dev3436' > >>> matplotlib.__version__ > '0.87.7' > >>> > > so random_array works fine in my version > > > On Mar 31, 2007, at 4:26 PM, Archana Ganesan wrote: > > Hi all, > > The exception I get is > Traceback (most recent call last): > File "App1.py", line 6, in ? > File "Frame1.pyc", line 9, in ? > File "Simulation.pyc", line 16, in ? > File "pylab.pyc", line 1, in ? > File "matplotlib\pylab.pyc", line 199, in ? > File "matplotlib\cm.pyc", line 5, in ? > File "matplotlib\colors.pyc", line 33, in ? > File "matplotlib\numerix\__init__.pyc", line 147, in ? > ImportError: No module named random_array > > I have numpy installed in site-packages. The setup.py that I am using is > as follows: > > Thanks, > Archana. > > > from distutils.core import setup > import os > from os.path import join > import shutil > > import glob > import py2exe > from py2exe.build_exe import py2exe > import sys > > import matplotlib > mpdir, mpfiles = matplotlib.get_py2exe_datafiles() > > # cleanup dist and build directory first (for new py2exe version) > if os.path.exists("dist/prog"): > shutil.rmtree("dist/prog") > > if os.path.exists("dist/lib"): > shutil.rmtree ("dist/lib") > > if os.path.exists("build"): > shutil.rmtree("build") > > options = {"py2exe": {"compressed": 1, > "optimize": 2, > "packages": ["encodings", > ## "kinterbasdb", > "pytz.zoneinfo.UTC", > #" matplotlib.numerix", > > ## "email", > ##"numpy" > ## "PIL", > ], > "excludes": ["MySQLdb", "Tkconstants", "Tkinter", > "tcl", > "orm.adapters.pgsql ", " > orm.adapters.mysql" > ], > "dll_excludes": ["tcl84.dll", "tk84.dll", > "wxmsw26uh_vc.dll"] > } > } > zipfile = r"lib\library.zip" > > setup( > classifiers = ["Copyright:: your name", > "Development Status :: 5 Stable", > "Intended Audience :: End User", > "License :: Shareware", > "Operating System :: Microsoft :: Windows 2000", > "Operating System :: Microsoft :: Windows XP", > "Operating System :: Microsoft :: Windows 9x", > "Programming Language :: Python, wxPython", > "Topic :: Home Use" > "Natural Language :: German", > "Natural Language :: French", > "Natural Language :: English"], > # windows = [wx_emb], > #console = [twcb], > options = options, > zipfile = zipfile, > data_files = [("lib\\matplotlibdata", mpfiles), > matplotlib.get_py2exe_datafiles() # if you don't use > the lib option > #### ("prog\\amaradata", amaradata), > #### ("prog\\amaradata\\Schemata", amaraschemata), > #### ("prog\\", python4dll) > ] > ) > > > On 3/31/07, Tommy Grav <tg...@ma...> wrote: > > > > It is hard to guess what exactly your problem is as you do not provide a > > code > > example or the traceback call of your exception. I would venture that > > you are > > trying to create a num_array without having Numerix, numpy or numarray > > imported > > or installed on your machine. > > > > Some more information about your troubles would be needed to really help > > you out. > > > > Cheers > > Tommy > > > > > > On Mar 31, 2007, at 3:50 PM, Archana Ganesan wrote: > > > > Hi all, > > I have a python application that uses matplotlib.I am trying to compile > > it into an executable using py2exe. I am encountering "No module named > > num_array problem". I do not know how to resolve this. I notice that " > > matplotlib.numerix" is in the included package. Did you encounter this > > problem. I am very new to this and I have to get it done by tomm. So I am > > sorry if it is really silly. > > > > Thanks, > > > > Archana. > > > > > > On 3/31/07, Archana Ganesan < arc...@gm... > wrote: > > > > > > Hi all, > > > > > > I have a python application that uses matplotlib. I want to compile it > > > into an executable. I tried using py2exe but it returned some error > > > w.rt matplotlib. Cpuld anyone please help me with this? Is there some > > > other way to get it done? > > > > > > Thanks, > > > Archana > > > > > > > ------------------------------------------------------------------------- > > > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV_______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > |
From: Werner F. B. <wer...@fr...> - 2007-04-02 09:47:35
|
Hi Archana, Archana Ganesan wrote: > Hi, > > I tried following the instructions at the py2exe site and I have also > uncommeneted and made it include the matplotlib.numerix package. Still > it doesnt seem to work. Is there any other way of compiling it into an > executable? Did you try to compile the sample I enclosed the other day? Did that work? If not what error are you getting. Are you using numpy or ? Provide a small sample (with no dependencies if possible) which does not work for you with the corresponding setup.py. Werner |
From: Giorgio L. <gio...@ch...> - 2007-04-03 10:13:00
|
I tried to compile the file and it seems to work (send by Werner). I'm also interested in the problem since I cannot succeed in compiling too with matplotlib (already followed the instruction found on py2exe) Hope to see how it develop and happy to know if anyone succeed in doing it Giorgio > |
From: Archana G. <arc...@gm...> - 2007-04-05 03:02:29
|
Hii, I get the following error. Traceback (most recent call last): File "trial.py", line 1, in ? File "pylab.pyo", line 1, in ? File "matplotlib\pylab.pyo", line 203, in ? File "matplotlib\axes.pyo", line 16, in ? File "matplotlib\axis.pyo", line 19, in ? File "matplotlib\patches.pyo", line 42, in ? File "matplotlib\patches.pyo", line 79, in Patch File "matplotlib\cbook.pyo", line 352, in dedent AttributeError: 'NoneType' object has no attribute 'splitlines' If I comment it out I am getting the error. I have installed the following: Python 2.4.4 http://www.python.org/download/releases/2.4.4/<https://webmailapp5.cc.utexas.edu/horde-2.2.9-assign/util/go.php?url=http%3A%2F%2Fwww.python.org%2Fdownload%2Freleases%2F2.4.4%2F&Horde=8f6e082f99784a0f28d75db1d492ba0f> wxPython runtime win32-unicode for Python 2.4 http://www.wxpython.org/download.php<https://webmailapp5.cc.utexas.edu/horde-2.2.9-assign/util/go.php?url=http%3A%2F%2Fwww.wxpython.org%2Fdownload.php&Horde=8f6e082f99784a0f28d75db1d492ba0f> matplotlib-0.90.0.win32-py2.4.exe http://sourceforge.net/project/showfiles.php?group_id=80706<https://webmailapp5.cc.utexas.edu/horde-2.2.9-assign/util/go.php?url=http%3A%2F%2Fsourceforge.net%2Fproject%2Fshowfiles.php%3Fgroup_id%3D80706&Horde=8f6e082f99784a0f28d75db1d492ba0f> numpy-1.0.1.win32-py2.4.exe http://sourceforge.net/project/showfiles.php?group_id=1369&package_id=175103<https://webmailapp5.cc.utexas.edu/horde-2.2.9-assign/util/go.php?url=http%3A%2F%2Fsourceforge.net%2Fproject%2Fshowfiles.php%3Fgroup_id%3D1369%26package_id%3D175103&Horde=8f6e082f99784a0f28d75db1d492ba0f> setup.py is as follows. from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") # # # options for py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", ## "kinterbasdb", "pytz", "matplotlib.numerix", ## "email", ## "numpy" ## "PIL", ], # "includes": "matplotlib.numerix.random_array", "excludes": ["MySQLdb", "Tkconstants", "Tkinter", "tcl", "orm.adapters.pgsql", "orm.adapters.mysql" ], "dll_excludes": ["tcl84.dll", "tk84.dll", "wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], # windows = [wx_emb], console = ['trial.py'], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), matplotlib.get_py2exe_datafiles() # if you don't use the lib option #### ("prog\\amaradata", amaradata), #### ("prog\\amaradata\\Schemata", amaraschemata), #### ("prog\\", python4dll) ] ) trial.py is as follows. from pylab import * x = xrange(10) plot(x) savefig("trial.png") Kindly help. thank you. Archana. My trial.py is as follows On 4/2/07, Werner F. Bruhin <wer...@fr...> wrote: > > Hi Archana, > > Archana Ganesan wrote: > > Hi, > > > > I tried following the instructions at the py2exe site and I have also > > uncommeneted and made it include the matplotlib.numerix package. Still > > it doesnt seem to work. Is there any other way of compiling it into an > > executable? > Did you try to compile the sample I enclosed the other day? Did that > work? If not what error are you getting. > > Are you using numpy or ? > > Provide a small sample (with no dependencies if possible) which does not > work for you with the corresponding setup.py. > > Werner > |
From: Werner F. B. <wer...@fr...> - 2007-04-05 07:28:08
|
Hi Archana, Archana Ganesan wrote: > ... > trial.py is as follows. > > from pylab import * > > x = xrange(10) > plot(x) > savefig("trial.png") > The setup.py you are using will not work, it is meant for a matplotlib embedded in wx, and even for that some lines are commented out. Can you try the setup.py I sent yesterday with which I included simple_plot.py, which is a script using pylab as you do in your trial.py. Werner |
From: Emmanuel <emm...@fa...> - 2007-04-08 11:17:45
|
Can I post also in that thread or should I open a new one? I'm also trying the first Werner F. Bruhin example. I saved the setup.py and the example in embedding_in_wx4.py then I run python.exe setup.py py2exe bdist When looking for dll, it fails claiming: Error: wxmsw26u_vc_enthought.dll : No such file or directory If I had manually the file file:///C:/Python24/Lib/site-packages/wx-2.6.1.0-py2.4-win32.egg/wx/wxmsw26_gl_vc_enthought.dll in the prog directory, it works fine. If I add wxmsw26_gl_vc_enthought.dll<file:///C:/Python24/Lib/site-packages/wx-2.6.1.0-py2.4-win32.egg/wx/wxmsw26_gl_vc_enthought.dll> to data_files it does not install in the prog directory but in the upperlevel directory. How could I include it in the right place directly? On 4/5/07, Werner F. Bruhin <wer...@fr...> wrote: > > Hi Archana, > > Archana Ganesan wrote: > > ... > > trial.py is as follows. > > > > from pylab import * > > > > x = xrange(10) > > plot(x) > > savefig("trial.png") > > > The setup.py you are using will not work, it is meant for a matplotlib > embedded in wx, and even for that some lines are commented out. > > Can you try the setup.py I sent yesterday with which I included > simple_plot.py, which is a script using pylab as you do in your trial.py. > > Werner > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Emmanuel <emm...@fa...> - 2007-04-08 13:38:33
|
when putting the full path of wxmsw26u_vc_enthought.dll in setup.py like this data_files = [("lib\\matplotlibdata", mpfiles), matplotlib.get_py2exe_datafiles(), # if you don't use the lib option "C:\\Python24\\Lib\\site-packages\\wx- 2.6.1.0-py2.4-win32.egg\\wx\\wxmsw26u_vc_enthought.dll", ## "wxmsw26u_vc_enthought.dll", #### ("prog\\", python4dll) ] and copying wxmsw26u_vc_enthought.dll in the same directory where setup.pyis. Running python setup.py py2exe it works "but" gives a 26Mb large dist directory with a lot of files. A good start. I'd like to know if it's possible to bundle all files in a zipped files or something similar What I obtain in dist is: [___lib [___matplolibdata [___matplotlibdata [___prog Files in lib are *.pyd,library.zip,wxmsw26u_vc_enthought.dll Files in lib\matplotib are *.afm,*.ppm,*.svg .... Files in matplotib are the same as in lib\matplotib FIles in prog are MSVCR71.dll,python24.dll,w9xpopen.exe,wx_embed.exe On 4/8/07, Emmanuel <emm...@fa...> wrote: > > Can I post also in that thread or should I open a new one? > > I'm also trying the first Werner F. Bruhin example. I saved the setup.pyand the example > in embedding_in_wx4.py then I run > > python.exe setup.py py2exe bdist > > > When looking for dll, it fails claiming: > Error: wxmsw26u_vc_enthought.dll : No such file or directory > > If I had manually the file > file:///C:/Python24/Lib/site-packages/wx-2.6.1.0-py2.4-win32.egg/wx/wxmsw26_gl_vc_enthought.dll > > in the prog directory, it works fine. > > If I add wxmsw26_gl_vc_enthought.dll to data_files it does not install in > the prog directory but in the upperlevel directory. > > How could I include it in the right place directly? > > > > On 4/5/07, Werner F. Bruhin <wer...@fr... > wrote: > > > > Hi Archana, > > > > Archana Ganesan wrote: > > > ... > > > trial.py is as follows. > > > > > > from pylab import * > > > > > > x = xrange(10) > > > plot(x) > > > savefig("trial.png") > > > > > The setup.py you are using will not work, it is meant for a matplotlib > > embedded in wx, and even for that some lines are commented out. > > > > Can you try the setup.py I sent yesterday with which I included > > simple_plot.py, which is a script using pylab as you do in your trial.py > > . > > > > Werner > > > > > > ------------------------------------------------------------------------- > > Take Surveys. Earn Cash. Influence the Future of IT > > Join SourceForge.net's Techsay panel and you'll get the chance to share > > your > > opinions on IT & business topics through brief surveys-and earn cash > > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > > > > _______________________________________________ > > Matplotlib-users mailing list > > Mat...@li... > > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > > > > |
From: Werner F. B. <wer...@fr...> - 2007-04-09 08:51:06
|
Hi Emmanuel, Maybe your problem has to do with your "enthought" build of wxPython. I use standard builds from wxPython site. Emmanuel wrote: > when putting the full path of wxmsw26u_vc_enthought.dll in setup.py > like this > > data_files = [("lib\\matplotlibdata", mpfiles), > matplotlib.get_py2exe_datafiles(), # if you don't > use the lib option You get two copies of matplotlibdata as you kept both of the two above lines active. You need to use the first one of you use the py2exe option to create a library.zip which I put into a sub-folder called 'lib' in the sample setup.py file. > "C:\\Python24\\Lib\\site-packages\\wx-2.6.1.0-py2.4-win32.egg\\wx\\wxmsw26u_vc_enthought.dll", > ## "wxmsw26u_vc_enthought.dll", > #### ("prog\\", python4dll) > ] > You are also using an 'egg'. I seem to recall that py2exe does not yet really support that, but you might want to check on the py2exe list (e.g. on the gmane mirror of it at http://dir.gmane.org/gmane.comp.python.py2exe Werner |
From: Archana G. <arc...@gm...> - 2007-04-11 19:27:45
|
Hi Werner, I tried what you suggested, using the setup file you had provided for simple_plot.py. But I get the following error, what should I do abt this? Traceback (most recent call last): File "simple_plot.py", line 1, in ? File "pylab.pyo", line 1, in ? File "matplotlib\pylab.pyo", line 203, in ? File "matplotlib\axes.pyo", line 16, in ? File "matplotlib\axis.pyo", line 19, in ? File "matplotlib\patches.pyo", line 42, in ? File "matplotlib\patches.pyo", line 79, in Patch File "matplotlib\cbook.pyo", line 352, in dedent AttributeError: 'NoneType' object has no attribute 'splitlines' Could you please tell me what I should do? Thanks a lot, Archana. On 4/9/07, Werner F. Bruhin <wer...@fr...> wrote: > > Hi Emmanuel, > > Maybe your problem has to do with your "enthought" build of wxPython. I > use standard builds from wxPython site. > > Emmanuel wrote: > > when putting the full path of wxmsw26u_vc_enthought.dll in setup.py > > like this > > > > data_files = [("lib\\matplotlibdata", mpfiles), > > matplotlib.get_py2exe_datafiles(), # if you don't > > use the lib option > You get two copies of matplotlibdata as you kept both of the two above > lines active. You need to use the first one of you use the py2exe > option to create a library.zip which I put into a sub-folder called > 'lib' in the sample setup.py file. > > "C:\\Python24\\Lib\\site-packages\\wx- > 2.6.1.0-py2.4-win32.egg\\wx\\wxmsw26u_vc_enthought.dll", > > ## "wxmsw26u_vc_enthought.dll", > > #### ("prog\\", python4dll) > > ] > > > You are also using an 'egg'. I seem to recall that py2exe does not yet > really support that, but you might want to check on the py2exe list > (e.g. on the gmane mirror of it at > http://dir.gmane.org/gmane.comp.python.py2exe > > Werner > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: Grant E. <gr...@vi...> - 2007-04-12 16:18:58
|
On 2007-04-01, Werner F. Bruhin <wer...@fr...> wrote: > Hi Archana, > > Sometimes py2exe can't figure out what needs to be included. In these > cases one creates entries in the packages section to force the inclusion > of one or multiple packages. > > Archana Ganesan wrote: >> Hi all, >> ... >> >> options = {"py2exe": {"compressed": 1, >> "optimize": 2, >> "packages": ["encodings", >> ## "kinterbasdb", >> "pytz.zoneinfo.UTC", >> #" matplotlib.numerix", >> > > You need to activate/un-comment the matplotlib.numerix line. Also note > that if you only include UTC and you use the timezone stuff in matplot > then a user NOT using UTC, i.e. another timezone will have a problem, it > is therefore better to just include all of pytz. Why does matplotlib need timezone data?? -- Grant Edwards grante Yow! Yow! Those people at look exactly like Donnie visi.com and Marie Osmond!! |
From: Archana G. <arc...@gm...> - 2007-04-12 16:34:20
|
Hi Werner, I am using matplotlib version 0.90.0 for python 2.4. Thank you, Archana. On 4/12/07, Grant Edwards <gr...@vi...> wrote: > > On 2007-04-01, Werner F. Bruhin <wer...@fr...> wrote: > > Hi Archana, > > > > Sometimes py2exe can't figure out what needs to be included. In these > > cases one creates entries in the packages section to force the inclusion > > of one or multiple packages. > > > > Archana Ganesan wrote: > >> Hi all, > >> ... > >> > >> options = {"py2exe": {"compressed": 1, > >> "optimize": 2, > >> "packages": ["encodings", > >> ## "kinterbasdb", > >> "pytz.zoneinfo.UTC", > >> #" matplotlib.numerix", > >> > > > > You need to activate/un-comment the matplotlib.numerix line. Also note > > that if you only include UTC and you use the timezone stuff in matplot > > then a user NOT using UTC, i.e. another timezone will have a problem, it > > is therefore better to just include all of pytz. > > Why does matplotlib need timezone data?? > > -- > Grant Edwards grante Yow! Yow! Those people > at look exactly like > Donnie > visi.com and Marie Osmond!! > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV > _______________________________________________ > Matplotlib-users mailing list > Mat...@li... > https://lists.sourceforge.net/lists/listinfo/matplotlib-users > |
From: rfv-370 <rob...@ya...> - 2007-05-29 05:50:42
|
I did reinstall my python with Python 2.5.1, Matplotlib 0.9, wxpython 2.8.4 and then it now works. Thanx Best Regards Robert rfv-370 wrote: > > I run on WinXP with > matplotlib 0.9.0 > python 2.4.3 (enthought edition) > wx.VERSION_STRING = 2.6.3.3 > > > rfv-370 wrote: >> >> Hello werner, >> >> I tried your small example to use your setup and your simple_plot but i >> get the following traceback: >> >> Traceback (most recent call last): >> File "simpletest.py", line 6, in ? >> File "pylab.pyo", line 1, in ? >> File "matplotlib\pylab.pyo", line 203, in ? >> File "matplotlib\axes.pyo", line 16, in ? >> File "matplotlib\axis.pyo", line 19, in ? >> File "matplotlib\patches.pyo", line 42, in ? >> File "matplotlib\patches.pyo", line 79, in Patch >> File "matplotlib\cbook.pyo", line 352, in dedent >> AttributeError: 'NoneType' object has no attribute 'splitlines' >> >> Did I miss something? >> >> Actually I am also trying to understand how to py2exe my own app. >> >> Thanx for help. >> >> Best Regards >> >> Robert >> >> Werner F. Bruhin wrote: >>> >>> Hi Giorgio, >>> >>> Had a quick look at pylab based scripts and got an error on >>> backend_tkagg when py2exe it. It looks like one needs to force the >>> backend to be included, I used tkagg but you would have to replace that >>> with wxagg for your script. >>> >>> Attached is a setup.py and from the examples the file simple_plot.py. >>> >>> Werner >>> >>> # -*- coding: iso-8859-1 -*-# >>> from distutils.core import setup >>> import os >>> from os.path import join >>> import shutil >>> >>> import glob >>> import py2exe >>> from py2exe.build_exe import py2exe >>> import sys >>> >>> import matplotlib >>> mpdir, mpfiles = matplotlib.get_py2exe_datafiles() >>> >>> # cleanup dist and build directory first (for new py2exe version) >>> if os.path.exists("dist/prog"): >>> shutil.rmtree("dist/prog") >>> >>> if os.path.exists("dist/lib"): >>> shutil.rmtree("dist/lib") >>> >>> if os.path.exists("build"): >>> shutil.rmtree("build") >>> >>> >>> >>> # >>> # A program using wxPython >>> >>> # The manifest will be inserted as resource into the .exe. This >>> # gives the controls the Windows XP appearance (if run on XP ;-) >>> # >>> manifest_template = ''' >>> <?xml version="1.0" encoding="UTF-8" standalone="yes"?> >>> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" >>> manifestVersion="1.0"> >>> <assemblyIdentity >>> version="5.0.0.0" >>> processorArchitecture="x86" >>> name="%(prog)s" >>> type="win32" >>> /> >>> <description>%(prog)s</description> >>> <dependency> >>> <dependentAssembly> >>> <assemblyIdentity >>> type="win32" >>> name="Microsoft.Windows.Common-Controls" >>> version="6.0.0.0" >>> processorArchitecture="X86" >>> publicKeyToken="6595b64144ccf1df" >>> language="*" >>> /> >>> </dependentAssembly> >>> </dependency> >>> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> >>> <security> >>> <requestedPrivileges> >>> <requestedExecutionLevel >>> level="AsInvoker" >>> uiAccess="false"/> >>> </requestedPrivileges> >>> </security> >>> </trustInfo> >>> </assembly> >>> ''' >>> >>> RT_MANIFEST = 32 >>> # >>> >>> # options for py2exe >>> options = {"py2exe": {"compressed": 1, >>> "optimize": 2, >>> "packages": ["encodings", >>> "pytz.zoneinfo.UTC", >>> "matplotlib.numerix", "matplotlib.backends.backend_tkagg" >>> ], >>> "excludes": ["MySQLdb", ], >>> "dll_excludes": ["wxmsw26uh_vc.dll"] >>> } >>> } >>> zipfile = r"lib\library.zip" >>> >>> class MetaBase: >>> def __init__(self, **kw): >>> self.__dict__.update(kw) >>> self.version = '1.0' >>> self.author = "yourname" >>> self.author_email = "na...@wh..." >>> self.company_name = "" >>> self.copyright = "2003 - 2007 by whoever" >>> self.url = "http://www.whatever.com/" >>> self.download_url = "http://www.whatever.com/en/" >>> self.trademark = "" >>> self.comments = "a comment on the prog" >>> self.name = "the prog name" >>> self.description = "a desc on the prog" >>> >>> wx_emb = MetaBase( >>> script = "simple_plot.py", >>> other_resources = [(RT_MANIFEST, 1, manifest_template % >>> dict(prog="your prog name"))], >>> ## icon_resources = [(1, r"images/some.ico")], >>> dest_base = r"prog\simple_plot") >>> >>> setup( >>> classifiers = ["Copyright:: your name", >>> "Development Status :: 5 Stable", >>> "Intended Audience :: End User", >>> "License :: Shareware", >>> "Operating System :: Microsoft :: Windows 2000", >>> "Operating System :: Microsoft :: Windows XP", >>> "Operating System :: Microsoft :: Windows 9x", >>> "Programming Language :: Python, wxPython", >>> "Topic :: Home Use" >>> "Natural Language :: German", >>> "Natural Language :: French", >>> "Natural Language :: English"], >>> windows = [wx_emb], >>> options = options, >>> zipfile = zipfile, >>> data_files = [("lib\\matplotlibdata", mpfiles), >>> ## matplotlib.get_py2exe_datafiles(), # if you don't >>> use the lib option >>> ] >>> ) >>> #!/usr/bin/env python >>> """ >>> Example: simple line plot. >>> Show how to make and save a simple line plot with labels, title and grid >>> """ >>> from pylab import * >>> >>> t = arange(0.0, 1.0+0.01, 0.01) >>> s = cos(2*2*pi*t) >>> plot(t, s) >>> >>> xlabel('time (s)') >>> ylabel('voltage (mV)') >>> title('About as simple as it gets, folks') >>> grid(True) >>> >>> #savefig('simple_plot.png') >>> savefig('simple_plot') >>> >>> show() >>> >>> ------------------------------------------------------------------------- >>> Take Surveys. Earn Cash. Influence the Future of IT >>> Join SourceForge.net's Techsay panel and you'll get the chance to share >>> your >>> opinions on IT & business topics through brief surveys-and earn cash >>> http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV >>> _______________________________________________ >>> Matplotlib-users mailing list >>> Mat...@li... >>> https://lists.sourceforge.net/lists/listinfo/matplotlib-users >>> >>> >> >> > > -- View this message in context: http://www.nabble.com/matplotlib-and-py2exe-tf3495922.html#a10848311 Sent from the matplotlib - users mailing list archive at Nabble.com. |
From: Robert V. <rob...@ya...> - 2007-05-28 11:03:59
|
Hello Werner, I run on WinXP with matplotlib 0.9.0 python 2.4.3 (enthought edition) wx.VERSION_STRING = 2.6.3.3 I tried your small example to use your setup and your simple_plot but i get the following traceback: Traceback (most recent call last): File "simpletest.py", line 6, in ? File "pylab.pyo", line 1, in ? File "matplotlib\pylab.pyo", line 203, in ? File "matplotlib\axes.pyo", line 16, in ? File "matplotlib\axis.pyo", line 19, in ? File "matplotlib\patches.pyo", line 42, in ? File "matplotlib\patches.pyo", line 79, in Patch File "matplotlib\cbook.pyo", line 352, in dedent AttributeError: 'NoneType' object has no attribute 'splitlines' Did I miss something? Actually I am also trying to understand how to py2exe my own app. Thanx for help. Best Regards Robert Werner F. Bruhin wrote: Hi Giorgio, Had a quick look at pylab based scripts and got an error on backend_tkagg when py2exe it. It looks like one needs to force the backend to be included, I used tkagg but you would have to replace that with wxagg for your script. Attached is a setup.py and from the examples the file simple_plot.py. Werner # -*- coding: iso-8859-1 -*-# from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") # # A program using wxPython # The manifest will be inserted as resource into the .exe. This # gives the controls the Windows XP appearance (if run on XP ;-) # manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32" /> <description>%(prog)s</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="AsInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> ''' RT_MANIFEST = 32 # # options for py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", "pytz.zoneinfo.UTC", "matplotlib.numerix", "matplotlib.backends.backend_tkagg" ], "excludes": ["MySQLdb", ], "dll_excludes": ["wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" class MetaBase: def __init__(self, **kw): self.__dict__.update(kw) self.version = '1.0' self.author = "yourname" self.author_email = "na...@wh..." self.company_name = "" self.copyright = "2003 - 2007 by whoever" self.url = "http://www.whatever.com/" self.download_url = "http://www.whatever.com/en/" self.trademark = "" self.comments = "a comment on the prog" self.name = "the prog name" self.description = "a desc on the prog" wx_emb = MetaBase( script = "simple_plot.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="your prog name"))], ## icon_resources = [(1, r"images/some.ico")], dest_base = r"prog\simple_plot") setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], windows = [wx_emb], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), ## matplotlib.get_py2exe_datafiles(), # if you don't use the lib option ] ) #!/usr/bin/env python """ Example: simple line plot. Show how to make and save a simple line plot with labels, title and grid """ from pylab import * t = arange(0.0, 1.0+0.01, 0.01) s = cos(2*2*pi*t) plot(t, s) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) #savefig('simple_plot.png') savefig('simple_plot') show() ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users « Return to thread Start a free forum or mailing list archive on Nabble Werner F. Bruhin wrote: > > Hi Archana, > > Archana Ganesan wrote: >> Hi all, >> >> I have a python application that uses matplotlib. I want to compile it >> into an executable. I tried using py2exe but it returned some error >> w.rt matplotlib. Cpuld anyone please help me with this? Is there some >> other way to get it done? > I am using matplotlib (currently 0.90) with wxPython and py2exe > (0.6.6). Attached are some sample files. > > I am on: > # Python 2.5 (r25:51908, Sep 19 2006, 09:52:17) [MSC v.1310 32 bit > (Intel)] > # wxPython 2.8.1.1, Boa Constructor 0.5.2 > > And as I am still using wxPython Ansi I renamed > > matplotlib/backends/_wxagg.pyd > > to > > matplotlib/backends/_wxagg not used.pyd > > Hope this helps > Werner > > > # -*- coding: iso-8859-1 -*-# > from distutils.core import setup > import os > from os.path import join > import shutil > > import glob > import py2exe > from py2exe.build_exe import py2exe > import sys > > import matplotlib > mpdir, mpfiles = matplotlib.get_py2exe_datafiles() > > # cleanup dist and build directory first (for new py2exe version) > if os.path.exists("dist/prog"): > shutil.rmtree("dist/prog") > > if os.path.exists("dist/lib"): > shutil.rmtree("dist/lib") > > if os.path.exists("build"): > shutil.rmtree("build") > > > > # > # A program using wxPython > > # The manifest will be inserted as resource into the .exe. This > # gives the controls the Windows XP appearance (if run on XP ;-) > # > manifest_template = ''' > <?xml version="1.0" encoding="UTF-8" standalone="yes"?> > <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> > <assemblyIdentity > version="5.0.0.0" > processorArchitecture="x86" > name="%(prog)s" > type="win32" > /> > <description>%(prog)s</description> > <dependency> > <dependentAssembly> > <assemblyIdentity > type="win32" > name="Microsoft.Windows.Common-Controls" > version="6.0.0.0" > processorArchitecture="X86" > publicKeyToken="6595b64144ccf1df" > language="*" > /> > </dependentAssembly> > </dependency> > <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> > <security> > <requestedPrivileges> > <requestedExecutionLevel > level="AsInvoker" > uiAccess="false"/> > </requestedPrivileges> > </security> > </trustInfo> > </assembly> > ''' > > RT_MANIFEST = 32 > # > > # options for py2exe > options = {"py2exe": {"compressed": 1, > "optimize": 2, > "packages": ["encodings", > ## "kinterbasdb", > "pytz.zoneinfo.UTC", > "matplotlib.numerix", > ## "email", > ## "numpy" > ## "PIL", > ], > "excludes": ["MySQLdb", "Tkconstants", "Tkinter", > "tcl", > "orm.adapters.pgsql", > "orm.adapters.mysql" > ], > "dll_excludes": ["tcl84.dll", "tk84.dll", > "wxmsw26uh_vc.dll"] > } > } > zipfile = r"lib\library.zip" > > class MetaBase: > def __init__(self, **kw): > self.__dict__.update(kw) > self.version = '1.0' > self.author = "yourname" > self.author_email = "na...@wh..." > self.company_name = "" > self.copyright = "2003 - 2007 by whoever" > self.url = "http://www.whatever.com/" > self.download_url = "http://www.whatever.com/en/" > self.trademark = "" > self.comments = "a comment on the prog" > self.name = "the prog name" > self.description = "a desc on the prog" > > wx_emb = MetaBase( > script = "embedding_in_wx4.py", > other_resources = [(RT_MANIFEST, 1, manifest_template % > dict(prog="your prog name"))], > ## icon_resources = [(1, r"images/some.ico")], > dest_base = r"prog\wx_embed") > > setup( > classifiers = ["Copyright:: your name", > "Development Status :: 5 Stable", > "Intended Audience :: End User", > "License :: Shareware", > "Operating System :: Microsoft :: Windows 2000", > "Operating System :: Microsoft :: Windows XP", > "Operating System :: Microsoft :: Windows 9x", > "Programming Language :: Python, wxPython", > "Topic :: Home Use" > "Natural Language :: German", > "Natural Language :: French", > "Natural Language :: English"], > windows = [wx_emb], > #console = [twcb], > options = options, > zipfile = zipfile, > data_files = [("lib\\matplotlibdata", mpfiles), > ## matplotlib.get_py2exe_datafiles(), # if you don't > use the lib option > #### ("prog\\amaradata", amaradata), > #### ("prog\\amaradata\\Schemata", amaraschemata), > #### ("prog\\", python4dll) > ] > ) > > #!/usr/bin/env python > """ > An example of how to use wx or wxagg in an application with a custom > toolbar > """ > > from matplotlib.numerix import arange, sin, pi > > import matplotlib > > # uncomment the following to use wx rather than wxagg > #matplotlib.use('WX') > #from matplotlib.backends.backend_wx import FigureCanvasWx as FigureCanvas > > # comment out the following to use wx rather than wxagg > matplotlib.use('WXAgg') > from matplotlib.backends.backend_wxagg import FigureCanvasWxAgg as > FigureCanvas > from matplotlib.backends.backend_wxagg import NavigationToolbar2WxAgg > > from matplotlib.backends.backend_wx import _load_bitmap > from matplotlib.figure import Figure > from matplotlib.numerix.mlab import rand > > import wx > > class MyNavigationToolbar(NavigationToolbar2WxAgg): > """ > Extend the default wx toolbar with your own event handlers > """ > ON_CUSTOM = wx.NewId() > def __init__(self, canvas, cankill): > NavigationToolbar2WxAgg.__init__(self, canvas) > > # for simplicity I'm going to reuse a bitmap from wx, you'll > # probably want to add your own. > self.AddSimpleTool(self.ON_CUSTOM, _load_bitmap('stock_left.xpm'), > 'Click me', 'Activate custom contol') > self.Bind(wx.EVT_TOOL, self._on_custom, id=self.ON_CUSTOM) > > def _on_custom(self, evt): > # add some text to the axes in a random location in axes (0,1) > # coords) with a random color > > # get the axes > ax = self.canvas.figure.axes[0] > > # generate a random location can color > x,y = tuple(rand(2)) > rgb = tuple(rand(3)) > > # add the text and draw > ax.text(x, y, 'You clicked me', > transform=ax.transAxes, > color=rgb) > self.canvas.draw() > evt.Skip() > > > class CanvasFrame(wx.Frame): > > def __init__(self): > wx.Frame.__init__(self,None,-1, > 'CanvasFrame',size=(550,350)) > > self.SetBackgroundColour(wx.NamedColor("WHITE")) > > self.figure = Figure(figsize=(5,4), dpi=100) > self.axes = self.figure.add_subplot(111) > t = arange(0.0,3.0,0.01) > s = sin(2*pi*t) > > self.axes.plot(t,s) > > self.canvas = FigureCanvas(self, -1, self.figure) > > self.sizer = wx.BoxSizer(wx.VERTICAL) > self.sizer.Add(self.canvas, 1, wx.TOP | wx.LEFT | wx.EXPAND) > # Capture the paint message > self.Bind(wx.EVT_PAINT, self.OnPaint) > > self.toolbar = MyNavigationToolbar(self.canvas, True) > self.toolbar.Realize() > if wx.Platform == '__WXMAC__': > # Mac platform (OSX 10.3, MacPython) does not seem to cope > with > # having a toolbar in a sizer. This work-around gets the > buttons > # back, but at the expense of having the toolbar at the top > self.SetToolBar(self.toolbar) > else: > # On Windows platform, default window size is incorrect, so > set > # toolbar width to figure width. > tw, th = self.toolbar.GetSizeTuple() > fw, fh = self.canvas.GetSizeTuple() > # By adding toolbar in sizer, we are able to put it at the > bottom > # of the frame - so appearance is closer to GTK version. > # As noted above, doesn't work for Mac. > self.toolbar.SetSize(wx.Size(fw, th)) > self.sizer.Add(self.toolbar, 0, wx.LEFT | wx.EXPAND) > > # update the axes menu on the toolbar > self.toolbar.update() > self.SetSizer(self.sizer) > self.Fit() > > > def OnPaint(self, event): > self.canvas.draw() > event.Skip() > > class App(wx.App): > > def OnInit(self): > 'Create the main window and insert the custom frame' > frame = CanvasFrame() > frame.Show(True) > > return True > > app = App(0) > app.MainLoop() > > > ------------------------------------------------------------------------- > Take Surveys. Earn Cash. Influence the Future of IT > Join SourceForge.net's Techsay panel and you'll get the chance to share > your > opinions on IT & business topics through brief surveys-and earn cash > http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV Werner F. Bruhin wrote: Hi Giorgio, Had a quick look at pylab based scripts and got an error on backend_tkagg when py2exe it. It looks like one needs to force the backend to be included, I used tkagg but you would have to replace that with wxagg for your script. Attached is a setup.py and from the examples the file simple_plot.py. Werner # -*- coding: iso-8859-1 -*-# from distutils.core import setup import os from os.path import join import shutil import glob import py2exe from py2exe.build_exe import py2exe import sys import matplotlib mpdir, mpfiles = matplotlib.get_py2exe_datafiles() # cleanup dist and build directory first (for new py2exe version) if os.path.exists("dist/prog"): shutil.rmtree("dist/prog") if os.path.exists("dist/lib"): shutil.rmtree("dist/lib") if os.path.exists("build"): shutil.rmtree("build") # # A program using wxPython # The manifest will be inserted as resource into the .exe. This # gives the controls the Windows XP appearance (if run on XP ;-) # manifest_template = ''' <?xml version="1.0" encoding="UTF-8" standalone="yes"?> <assembly xmlns="urn:schemas-microsoft-com:asm.v1" manifestVersion="1.0"> <assemblyIdentity version="5.0.0.0" processorArchitecture="x86" name="%(prog)s" type="win32" /> <description>%(prog)s</description> <dependency> <dependentAssembly> <assemblyIdentity type="win32" name="Microsoft.Windows.Common-Controls" version="6.0.0.0" processorArchitecture="X86" publicKeyToken="6595b64144ccf1df" language="*" /> </dependentAssembly> </dependency> <trustInfo xmlns="urn:schemas-microsoft-com:asm.v3"> <security> <requestedPrivileges> <requestedExecutionLevel level="AsInvoker" uiAccess="false"/> </requestedPrivileges> </security> </trustInfo> </assembly> ''' RT_MANIFEST = 32 # # options for py2exe options = {"py2exe": {"compressed": 1, "optimize": 2, "packages": ["encodings", "pytz.zoneinfo.UTC", "matplotlib.numerix", "matplotlib.backends.backend_tkagg" ], "excludes": ["MySQLdb", ], "dll_excludes": ["wxmsw26uh_vc.dll"] } } zipfile = r"lib\library.zip" class MetaBase: def __init__(self, **kw): self.__dict__.update(kw) self.version = '1.0' self.author = "yourname" self.author_email = "na...@wh..." self.company_name = "" self.copyright = "2003 - 2007 by whoever" self.url = "http://www.whatever.com/" self.download_url = "http://www.whatever.com/en/" self.trademark = "" self.comments = "a comment on the prog" self.name = "the prog name" self.description = "a desc on the prog" wx_emb = MetaBase( script = "simple_plot.py", other_resources = [(RT_MANIFEST, 1, manifest_template % dict(prog="your prog name"))], ## icon_resources = [(1, r"images/some.ico")], dest_base = r"prog\simple_plot") setup( classifiers = ["Copyright:: your name", "Development Status :: 5 Stable", "Intended Audience :: End User", "License :: Shareware", "Operating System :: Microsoft :: Windows 2000", "Operating System :: Microsoft :: Windows XP", "Operating System :: Microsoft :: Windows 9x", "Programming Language :: Python, wxPython", "Topic :: Home Use" "Natural Language :: German", "Natural Language :: French", "Natural Language :: English"], windows = [wx_emb], options = options, zipfile = zipfile, data_files = [("lib\\matplotlibdata", mpfiles), ## matplotlib.get_py2exe_datafiles(), # if you don't use the lib option ] ) #!/usr/bin/env python """ Example: simple line plot. Show how to make and save a simple line plot with labels, title and grid """ from pylab import * t = arange(0.0, 1.0+0.01, 0.01) s = cos(2*2*pi*t) plot(t, s) xlabel('time (s)') ylabel('voltage (mV)') title('About as simple as it gets, folks') grid(True) #savefig('simple_plot.png') savefig('simple_plot') show() ------------------------------------------------------------------------- Take Surveys. Earn Cash. Influence the Future of IT Join SourceForge.net's Techsay panel and you'll get the chance to share your opinions on IT & business topics through brief surveys-and earn cash http://www.techsay.com/default.php?page=join.php&p=sourceforge&CID=DEVDEV _______________________________________________ Matplotlib-users mailing list Mat...@li... https://lists.sourceforge.net/lists/listinfo/matplotlib-users if( self == top ) { Nabble.writeReturnToLink( 'Return to thread' ); } else if( Nabble.prev ) Nabble.writeReturnToLink(Nabble.prev); --------------------------------- Ne gardez plus qu'une seule adresse mail ! Copiez vos mails vers Yahoo! Mail |