[python-win32] Excel + pyinstaller: missing a constant: xlTopToBottom

Mark Hammond skippy.hammond at gmail.com
Tue Apr 30 06:09:24 CEST 2013


On 30/04/2013 2:21 AM, Niemann, Hartmut wrote:
> Hello!
> The following snippet
> from win32com.client import constants as xl_constants
> wbook.ActiveSheet.Range('A3:N' + str(row + 1)).Sort(
>          Key1 = wbook.ActiveSheet.Range('B3'),
> Orientation = xl_constants.xlTopToBottom,
> DataOption1 = xl_constants.xlSortTextAsNumbers
> )

The above works be leveraging "makepy" support - so something (either 
code not shown above, or by manually running makepy.py) has generated a 
file with the Excel object model, including the constants.

> from a script that is exe-fied with pyinstaller fails with
> Traceback (most recent call last):
>    File "<string>", line 502, in process_chain
>    File "<string>", line 451, in process_project
>    File "<string>", line 330, in create_fg
>    File "D:\temp\lib_chain\out00-PYZ.pyz\win32com.client", line 170, in
> __getattr__
> AttributeError: xlTopToBottom
> Is this a pywin problem? Do we need to instruct pyinstaller to work
> differently to cooperate with Excel?
> Any ideas?
> (This is python 2.7.3 on Windows XP)

You need to tell pyinstaller to use makepy support for certain objects. 
  py2exe has basic support for that, but I'm not familiar with 
pyinstaller to tell you how it might be done there - you probably need 
to find a pyinstaller mailing list and ask there.

HTH,

Mark

>
> Mit freundlichen Grüßen
> Dr. Hartmut Niemann
>
> Siemens AG
> Infrastructure & Cities Sector
> Rail Systems Division
> Locomotives and Components
> IC RL LOC EN LE 8
> Werner-von-Siemens-Str. 67
> 91052 Erlangen, Deutschland
> Tel.: +49 9131 7-34264
> Fax: +49 9131 7-26254
> mailto:hartmut.niemann at siemens.com
>
> Siemens Aktiengesellschaft: Vorsitzender des Aufsichtsrats: Gerhard
> Cromme; Vorstand: Peter Löscher, Vorsitzender; Roland Busch, Brigitte
> Ederer, Klaus Helmrich, Joe Kaeser, Barbara Kux, Hermann Requardt,
> Siegfried Russwurm, Peter Y. Solmssen, Michael Süß; Sitz der
> Gesellschaft: Berlin und München, Deutschland; Registergericht: Berlin
> Charlottenburg, HRB 12300, München, HRB 6684; WEEE-Reg.-Nr. DE 23691322
>
>
>
> _______________________________________________
> python-win32 mailing list
> python-win32 at python.org
> http://mail.python.org/mailman/listinfo/python-win32
>



More information about the python-win32 mailing list