473,574 Members | 3,142 Online
Bytes | Software Development & Data Engineering Community
+ Post

Home Posts Topics Members FAQ

regarding making an exe (of a package using matplotlib) using py2exe

15 New Member
i hav python2.5, matplotlib0.90. 1, and py2exe for python 2.5 all on windows xp... i hav a python program(letsc.p y) which uses the matplotlib package... and i want 2 make an exe of it for distribution on other comps... i used py2exe... i wrote a setup.py whose contents are :
Expand|Select|Wrap|Line Numbers
  1. from distutils.core import setup
  2. import py2exe
  3. import matplotlib
  5. setup(console=['letsc.py'],
  6. options={
  7. 'py2exe': {
  8. 'packages' : ['matplotlib', 'pytz'],
  9. }
  10. },
  11. data_files=[matplotlib.get_py2exe_datafiles()])
as per the site http://www.py2exe.org/index.cgi/MatPlotLib... welll in the command prompt (not >>>) i typed [in the correct directory] "python setup.py py2exe". it gave out a lot of text on the console but finally in the end it displayed "error: can't copy 'F:\Python25\Li b\site-packages\matplo tlib\mpl-data\fonts' : does'nt exist or not a regular file" (when actually there is a directory called mpl-data which has 3 subdirectories ... afm, pdfcorefonts and ttf) and the process stops.
It creates the usual dist and build folders but there isnt the required exe in the dist folder...
so i tried this setup.py:
Expand|Select|Wrap|Line Numbers
  1. # setup.py
  2. from distutils.core import setup
  3. import glob
  4. import py2exe
  5. import matplotlib
  7. data = glob.glob(r'F:\Python25\Lib\site-packages\matplotlib\*\*\*\*\*')
  9. setup(windows=["letsc.py"],
  10.      options={
  11.              'py2exe': {
  12.                         'packages' : ['matplotlib', 'pytz'],
  13.                        }
  14.             },
  16.             data_files=[("matplotlibdata",data)],
  17.       )
Well... here it successfully compiles and i get a letsc.exe but on running it the error log says:
Exception in Tkinter callback
Traceback (most recent call last):
File "Tkinter.py c", line 1403, in __call__
File "letsc.py", line 49, in Display
File "matplotlib\pyl ab.pyc", line 2023, in plot
File "matplotlib\pyl ab.pyc", line 937, in ishold
File "matplotlib\pyl ab.pyc", line 883, in gca
File "matplotlib\pyl ab.pyc", line 893, in gcf
File "matplotlib\pyl ab.pyc", line 859, in figure
File "matplotlib\bac kends\backend_t kagg.pyc", line 90, in new_figure_mana ger
File "matplotlib\bac kends\backend_t kagg.pyc", line 274, in __init__
File "matplotlib\bac kends\backend_t kagg.pyc", line 545, in __init__
File "matplotlib\bac kend_bases.pyc" , line 1163, in __init__
File "matplotlib\bac kends\backend_t kagg.pyc", line 590, in _init_toolbar
File "matplotlib\bac kends\backend_t kagg.pyc", line 573, in _Button
File "Tkinter.py c", line 3270, in __init__
File "Tkinter.py c", line 3226, in __init__
TclError: couldn't open "F:\Python25\di st\matplotlibda ta\images\home. ppm": no such file or directory
... basically now matplotlib seems 2 b a pain in the ***... sorry for the long post... but any help?
Jun 15 '07 #1
3 4706
6,596 Recognized Expert Expert
I know that this is not exactly what you are looking for, but there is a script here that will do all the command-line stuff when it is run (in the proper directory) and shows how to start using "includes" and "excludes".

Hope that helps.
Jun 15 '07 #2
15 New Member
I know that this is not exactly what you are looking for,
Bartonc appreciate ur help a lot... thanx... but thr's not a word of matplotlib in thr... basically the whole pain is tht matplotlib's modules or watever they r called arnt being put in the dist folder... see i'll put in my .py script also... mebbe tht mite help... here it is ........ letsc.py:
Expand|Select|Wrap|Line Numbers
  1. from Tkinter import *
  4. class GUIFramework(Frame):
  5.     """This is the GUI"""
  7.     def __init__(self,master=None):
  8.         """Initialize yourself"""
  10.         """Initialise the base class"""
  11.         Frame.__init__(self,master)
  13.         """Set the Window Title"""
  14.         self.master.title("Type Some Text")
  16.         """Display the main window"
  17.         with a little bit of padding"""
  18.         self.grid(padx=10,pady=10)
  19.         self.CreateWidgets()
  21.     def CreateWidgets(self):
  22.         """Create all the widgets that we need"""
  24.         """Create the Text"""
  27.         """Create the Entry, set it to be a bit wider"""
  28.         self.enText1 = Entry(self)
  29.         self.enText1.grid(row=0, column=1, columnspan=3)
  31.         self.enText2 = Entry(self)
  32.         self.enText2.grid(row=1, column=1, columnspan=3)
  34.         self.enText3 = Entry(self)
  35.         self.enText3.grid(row=2, column=1, columnspan=3)
  38.         """Create the Button, set the text and the 
  39.         command that will be called when the button is clicked"""
  40.         self.btnDisplay = Button(self, text="Display!", command=self.Display)
  41.         self.btnDisplay.grid(row=0, column=4)
  43.     def Display(self):
  44.         from pylab import *
  45.         """Called when btnDisplay is clicked, displays the contents of self.enText"""
  46.         t = arange(0.0, 2.0, 0.01)
  47.         s = (float(self.enText1.get()))*t*t + (float(self.enText2.get()))*t + (float(self.enText3.get()))
  48.         plot(t, s, linewidth=1.0)
  50.         xlabel('x (m)')
  51.         ylabel('T (K)')
  52.         title('The sought after Graph!!!')
  53.         grid(True)
  54.         show()        
  55. if __name__ == "__main__":
  56.     guiFrame = GUIFramework()
  57.     guiFrame.mainloop()
in short if i click the display button it shud pop out a graph [using the libraries of matplotlib] in my face but for some reason wen i click on display i get the error message in the log as seen in my previous post... any ideas guys? seriously py2exe+matplotl ib==frustration as i read sumwhere while googling!!!
Jun 15 '07 #3
6,596 Recognized Expert Expert
I know that this is not exactly what you are looking for, but there is a script here that will do all the command-line stuff when it is run (in the proper directory) and shows how to start using "includes" and "excludes".

Hope that helps.
Frustration is just a frame of mind. Trial and error are part of this process. My point was that you must learn (from the error messages) which modules are not automatically being included. Then using a script that will do all the command-line stuff for you (to reduce the frustration factor), you'll get to PLAY with the includes option until the errors abate.

And have fun. You'll be the expert in this area in no time!
Jun 16 '07 #4

Sign in to post your reply or Sign up for a free account.

Similar topics

by: John Carter | last post by:
Does anyone know how to embed PIL into a py2exe program. As far as I can tell PIL is not finding its plugins for Image I/O, they are imported dynamically as required. So I cant load or save pictures I tried making a copy of the plugin files to the application directory, but I've had no luck in making the code see the files I'd be...
by: Blaze Bresko | last post by:
hey, I am using python 2.4 and py2exe v 0.6. I have made a program using pygame/livewires. I have the newest version of both but i dont know what version they are (im on a different computer right now). When I use py2exe to make the exe file, it works and there are no errors in the whole thing. When I run the exe, it doesn't like the last...
by: archana | last post by:
Hi all, I am having one confusion regarding changing cursor to wait cursor I am providing auto refreshing facility for listview using timer. So what i am doing is when auto refreshing is in progress i am changing cursor to hour glass to indicate user that application is busy in background processing.
by: Marcus | last post by:
Hi, I'm to the stage where I need to deploy the app I built with wxPython. I've been able to successfully build it w/py2exe into a binary (about 10MB size in total). What I'd like to do is create an automatic updater, so that I can have users download updated versions of my *application code* without having to have them redownload...
by: =?ISO-8859-15?Q?J=FCrgen_Kareta?= | last post by:
Hello List, my customer is looking for an application to show some simple 2d graphs based on messured data. I'm consider to use wxpython, matplotlib and py2exe to build and compile this application. Mayby I also like to use WxMPL and inosetup. The target platform is XP embedded. As I don't have XP embedded available, I can't try it out.
by: amitp | last post by:
Hello, I've a DTS Package in which i'm using Execute SQL Task. It's having a connection CON1. I've a function which is defined at DataBase level CON2. The query in the Execute SQL Task is an Update Query. It takes data from CON2 and updates in CON1. SO how can i call the function which is defined at database level into my Execute SQL...
by: stacionari | last post by:
HI, My query is like this: SELECT tag.* FROM tag LEFT JOIN book_item ON tag.Tag_ID = book_item.BookItem_ID WHERE tag.Tag = "tags" GROUP BY tag.tag_ID Indexes: Table 'tag': Keyname Type Cardinality Field
by: satyasri2test | last post by:
Hi, Can some one provide me the complete example for using FILTER USING option in CREATE FUNCTION (External Scalar) for DB2 LUW 9.5. I have verified the sample given in the SQL Reference Volume2, but that is incomplete. With thanks, satyasri
by: Chriskim | last post by:
Hi~ I am trying to make a little program that generates a graph that constantly changes as I change the input variable by using spinbox. Simply it's like an oscilloscope where time is my x-axis and y is my voltage. And I want to be able to see the change in voltage spike as time passes. I used pywt first, but I want to use matplotlib to...
by: Hystou | last post by:
Most computers default to English, but sometimes we require a different language, especially when relocating. Forgot to request a specific language before your computer shipped? No problem! You can effortlessly switch the default language on Windows 10 without reinstalling. I'll walk you through it. First, let's disable language...
by: Oralloy | last post by:
Hello folks, I am unable to find appropriate documentation on the type promotion of bit-fields when using the generalised comparison operator "<=>". The problem is that using the GNU compilers, it seems that the internal comparison operator "<=>" tries to promote arguments from unsigned to signed. This is as boiled down as I can make it. ...
by: jinu1996 | last post by:
In today's digital age, having a compelling online presence is paramount for businesses aiming to thrive in a competitive landscape. At the heart of this digital strategy lies an intricately woven tapestry of website design and digital marketing. It's not merely about having a website; it's about crafting an immersive digital experience that...
by: Hystou | last post by:
Overview: Windows 11 and 10 have less user interface control over operating system update behaviour than previous versions of Windows. In Windows 11 and 10, there is no way to turn off the Windows Update option using the Control Panel or Settings app; it automatically checks for updates and installs any it finds, whether you like it or not. For...
by: tracyyun | last post by:
Dear forum friends, With the development of smart home technology, a variety of wireless communication protocols have appeared on the market, such as Zigbee, Z-Wave, Wi-Fi, Bluetooth, etc. Each protocol has its own unique characteristics and advantages, but as a user who is planning to build a smart home system, I am a bit confused by the...
by: isladogs | last post by:
The next Access Europe User Group meeting will be on Wednesday 1 May 2024 starting at 18:00 UK time (6PM UTC+1) and finishing by 19:30 (7.30PM). In this session, we are pleased to welcome a new presenter, Adolph Dupré who will be discussing some powerful techniques for using class modules. He will explain when you may want to use classes...
by: adsilva | last post by:
A Windows Forms form does not have the event Unload, like VB6. What one acts like?
by: 6302768590 | last post by:
Hai team i want code for transfer the data from one system to another through IP address by using C# our system has to for every 5mins then we have to update the data what the data is updated we have to send another system
by: bsmnconsultancy | last post by:
In today's digital era, a well-designed website is crucial for businesses looking to succeed. Whether you're a small business owner or a large corporation in Toronto, having a strong online presence can significantly impact your brand's success. BSMN Consultancy, a leader in Website Development in Toronto offers valuable insights into creating...

By using Bytes.com and it's services, you agree to our Privacy Policy and Terms of Use.

To disable or enable advertisements and analytics tracking please visit the manage ads & tracking page.