Menu

#25 Add file resources to py2exe

open
nobody
None
5
2011-06-26
2011-06-26
Nor
No

I've found it very hard to simply add a file as a resource.
their are all sorts of tool to work around this but most are
to complex for my simple needs.

here is what I done, i've tested it and it works great.

<path>Python26\Lib\site-packages\py2exe\build_exe.py is the file I added to.

after line 891 : add_resource(ensure_unicode(exe_path), bmp_data[14:], RT_BITMAP, bmp_id, False)

I added these lines

[code]
####
file_resources = getattr(target, "file_resources", [])
for file_id, file_name in file_resources:
file_data = open(file_name, "rb").read()
if not self.dry_run:
add_resource(ensure_unicode(exe_path), file_data, 10, file_id, False)
####
[/code]

Discussion

  • Nor

    Nor - 2011-07-24

    Python26\Lib\site-packages\py2exe\build_exe.py

     
  • Nor

    Nor - 2011-07-24

    Sorry, forgot to upload the edited file

     

Log in to post a comment.