Bundling XLRD

59 views
Skip to first unread message

Sumit Bisht

unread,
Jul 3, 2012, 9:59:02 AM7/3/12
to python-excel
Hi !
I am using XLRD to read data in my application. However, I need to
package the python application into an executable. As the xlrd package
is well over 1mb and contains many files, is there any optimum way of
bundling the library into my application(getting it in pythonpath)
easily?
Thanks

John Machin

unread,
Jul 3, 2012, 4:05:33 PM7/3/12
to python-excel


On Jul 3, 11:59 pm, Sumit Bisht <sumitbisht1...@gmail.com> wrote:
> Hi !
> I am using XLRD to read data in my application. However, I need to
> package the python application into an executable. As the xlrd package
> is well over 1mb and contains many files,

Directory of C:\xlrd\0.7.9_setup\dist\xlrd-0.7.9\xlrd

13/04/2012 11:28 PM 17,505 biffh.py
13/04/2012 11:28 PM 21,288 compdoc.py
13/04/2012 11:28 PM 45,817 formatting.py
16/04/2012 08:18 AM 94,063 formula.py
21/06/2012 08:05 AM 22 info.py
21/10/2011 08:17 PM 3,406 licences.py
21/06/2012 08:00 AM 106,703 sheet.py
21/06/2012 07:59 AM 1,102 timemachine.py
21/10/2011 08:17 PM 6,481 xldate.py
21/06/2012 07:59 AM 76,090 __init__.py
10 File(s) 372,477 bytes

Over 1mb? 10 == many?

> is there any optimum way of
> bundling the library into my application(getting it in pythonpath)
> easily?

Bundling xlrd along with a Python app into an exe is no different to
bundling any other pure-Python library. How you do it depends on what
bundler (py2exe | cxfreeze | PyInstaller) you use. Each bundler has
various options. "Optimum" is your choice. What have you tried?

Werner

unread,
Jul 4, 2012, 3:07:53 AM7/4/12
to python...@googlegroups.com
Hi,
I use py2exe when I started using XLRD and wanted to pack it with my
application I did not have to change anything in my setup.py.

I use these options:
setup(

data_files = data_files,

options = {"py2exe": {"compressed": 2,
"optimize": 2,
"includes": includes,
"excludes": excludes,
"packages": packages,
"dll_excludes": dll_excludes,
"bundle_files": 2,
"dist_dir": distDir,
"xref": False,
"skip_archive": False,
"ascii": False,
"custom_boot_script": '',
}
},

zipfile = r'lib\library.zip',
console = [GUI2Exe_Target_2],
windows = [GUI2Exe_Target_1, GUI2Exe_Target_3]
)

and I get an XLRD folder in the library.zip with the files listed by
John in his answer (except info.py which I don't have in my install
folder either - I am still on 0.7.3).

Werner


Sumit Bisht

unread,
Jul 19, 2012, 3:00:43 AM7/19/12
to python...@googlegroups.com
Sorry about the late reply, currently I was copying entire library into the folder.
Bundling libraries via py2exe does not apply in this case as my application executable will generate another application that uses these libraries, so I needed libraries at the specified location within the project. By copying only the source files, the project is working fine.
Reply all
Reply to author
Forward
0 new messages