SourceForge logo
SourceForge logo
Menu

[matplotlib-devel] get_py2exe_datafiles fix

From: Tim S. <pur...@gm...> - 2007年06月30日 01:34:30
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.

View entire thread

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.
Thanks for helping keep SourceForge clean.
X





Briefly describe the problem (required):
Upload screenshot of ad (required):
Select a file, or drag & drop file here.
Screenshot instructions:

Click URL instructions:
Right-click on the ad, choose "Copy Link", then paste here →
(This may not be possible with some types of ads)

More information about our ad policies

Ad destination/click URL:

AltStyle によって変換されたページ (->オリジナル) /