I was having trouble with py2exe not getting the datafiles that it needed. I noticed someone else got it to work by copying all the files, but losing the directory structure. I tried that, but I still had missing datafiles at runtime.
This function will return everything needed for py2exe to work correctly. Instead of returning one tuple, it returns a list of tuples, so the use changes a little bit, but at least it works.
def get_py2exe_datafiles():
outdirname = 'matplotlibdata'
mplfiles = []
for root, dirs, files in os.walk(get_data_path()):
py2exe_files = []
# Append root to each file so py2exe can find them
for file in files:
py2exe_files.append(os.sep.join([root, file]))
if len(py2exe_files) > 0:
py2exe_root = root[len(get_data_path()+os.sep):]
if len(py2exe_root) > 0:
mplfiles.append((os.sep.join([outdirname, py2exe_root]), py2exe_files))
else:
# Don't do a join for the root directory
mplfiles.append((outdirname, py2exe_files))
return mplfiles
Sorry for not submitting as a patch: I haven’t quite figured out how to do that yet.
Dear Tim,
I checked in a similar patch from Tocer a couple days ago. Does your version do anything different? Does the version in svn work for you?
(Sorry, I don't really use Windows or py2exe.)
-Andrew
Tim Swast wrote:
···
I was having trouble with py2exe not getting the datafiles that it needed. I noticed someone else got it to work by copying all the files, but losing the directory structure. I tried that, but I still had missing datafiles at runtime.
This function will return everything needed for py2exe to work correctly. Instead of returning one tuple, it returns a list of tuples, so the use changes a little bit, but at least it works.
def get_py2exe_datafiles():
outdirname = 'matplotlibdata'
mplfiles =
for root, dirs, files in os.walk(get_data_path()):
py2exe_files =
# Append root to each file so py2exe can find them
for file in files:
py2exe_files.append(os.sep.join([root, file]))
if len(py2exe_files) > 0:
py2exe_root = root[len(get_data_path()+os.sep):]
if len(py2exe_root) > 0:
mplfiles.append((os.sep.join([outdirname, py2exe_root]), py2exe_files))
else:
# Don't do a join for the root directory
mplfiles.append((outdirname, py2exe_files))
return mplfiles
Sorry for not submitting as a patch: I haven't quite figured out how to do that yet.
------------------------------------------------------------------------
-------------------------------------------------------------------------
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
------------------------------------------------------------------------
_______________________________________________
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
matplotlib-devel List Signup and Options
I haven’t tried the svn version yet, but it looks like it does basically the same thing as my version. The only thing different with mine I think is that if there are empty directories, I don’t add them to the list.
···
On 6/30/07, Andrew Straw <strawman@…36…> wrote:
Dear Tim,
I checked in a similar patch from Tocer a couple days ago. Does your
version do anything different? Does the version in svn work for you?
http://matplotlib.svn.sourceforge.net/viewvc/matplotlib/trunk/matplotlib/lib/matplotlib/init.py?r1=3391&r2=3418
(Sorry, I don’t really use Windows or py2exe.)
-Andrew
Tim Swast wrote:
I was having trouble with py2exe not getting the datafiles that it
needed. I noticed someone else got it to work by copying all the files,
but losing the directory structure. I tried that, but I still had
missing datafiles at runtime.
This function will return everything needed for py2exe to work
correctly. Instead of returning one tuple, it returns a list of tuples,
so the use changes a little bit, but at least it works.
def get_py2exe_datafiles():
outdirname = ‘matplotlibdata’
mplfiles =
for root, dirs, files in os.walk(get_data_path()):
py2exe_files = []
# Append root to each file so py2exe can find them
for file in files:
py2exe_files.append(os.sep.join([root, file]))
if len(py2exe_files) > 0:
py2exe_root = root[len(get_data_path()+os.sep):]
if len(py2exe_root) > 0:
mplfiles.append((os.sep.join([outdirname, py2exe_root]),
py2exe_files))
else:
# Don't do a join for the root directory
mplfiles.append((outdirname, py2exe_files))
return mplfiles
Sorry for not submitting as a patch: I haven’t quite figured out how to
do that yet.
This SF.net email is sponsored by DB2 Express
Download DB2 Express C - the FREE version of DB2 express and take
control of your XML. No limits. Just data. Click to get it now.
http://sourceforge.net/powerbar/db2/
Matplotlib-devel mailing list
Matplotlib-devel@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/matplotlib-devel