Stat merge in Ctables with Python (Another)

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

Stat merge in Ctables with Python (Another)

Auberth Hurtado
Another,

- With the next syntax:

BEGIN PROGRAM PYTHON.
import sys, spss, tables
help (spss)
help (tables)
END PROGRAM.

CTABLES
  /TABLE sex > race [COUNT  COLPCT.COUNT] BY region
  /TITLES TITLE='This is the Main Table'
  /COMPARETEST TYPE=PROP ALPHA=0.05 ADJUST=BONFERRONI ORIGIN=COLUMN.

BEGIN PROGRAM PYTHON.
tables.mergeLatest(hide=False)
END PROGRAM.


- I obtain the following error:

Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "C:\Python24\lib\site-packages\tables.py", line 167, in mergeLatest
    addlabelleaf=addlabelleaf, appendtitle=appendtitle,
appendcaption=appendcaption)
  File "C:\Python24\lib\site-packages\tables.py", line 229, in tmerge
    rowfunc, colfunc, mode)
  File "C:\Python24\lib\site-packages\tables.py", line 326, in settbl
    datacells.SetHAlignAt(i,j,1)  # right align cell
  File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 496,
in __getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: DataCellArray.SetHAlignAt

At least my computer does not died.

Thanks

Auberth Eduardo Hurtado
Reply | Threaded
Open this post in threaded view
|

Re: Stat merge in Ctables with Python (Another)

Peck, Jon
This indicates that you have not run the makepy step that is required for the automation interfaces to work with Python.  The easiest way to do this is to start Pythonwin from the Start menu and on the Tools menu, choose makepy.

That brings up a window listing all of the automation libraries you have installed (you will be amazed).  Scroll down to the SPSS libraries, and choose the newest version of each one and press ok.  Do this one library at a time.  The window allows you to do a multiple selection, but it only honors the first item in the selection.  (We didn't design that window!)

The particular library that is causing the failure is the SPSS pivot table library, but you might as well do the others, too.

You only have to do this process once, but without it, the viewer methods in the tables module cannot function.

Regards,
Jon Peck


-----Original Message-----
From: SPSSX(r) Discussion on behalf of Auberth Hurtado
Sent: Thu 9/27/2007 4:51 PM
To: [hidden email]
Subject:      [SPSSX-L] Stat merge in Ctables with Python (Another)
 
Another,

- With the next syntax:

BEGIN PROGRAM PYTHON.
import sys, spss, tables
help (spss)
help (tables)
END PROGRAM.

CTABLES
  /TABLE sex > race [COUNT  COLPCT.COUNT] BY region
  /TITLES TITLE='This is the Main Table'
  /COMPARETEST TYPE=PROP ALPHA=0.05 ADJUST=BONFERRONI ORIGIN=COLUMN.

BEGIN PROGRAM PYTHON.
tables.mergeLatest(hide=False)
END PROGRAM.


- I obtain the following error:

Traceback (most recent call last):
  File "<string>", line 1, in ?
  File "C:\Python24\lib\site-packages\tables.py", line 167, in mergeLatest
    addlabelleaf=addlabelleaf, appendtitle=appendtitle,
appendcaption=appendcaption)
  File "C:\Python24\lib\site-packages\tables.py", line 229, in tmerge
    rowfunc, colfunc, mode)
  File "C:\Python24\lib\site-packages\tables.py", line 326, in settbl
    datacells.SetHAlignAt(i,j,1)  # right align cell
  File "C:\Python24\Lib\site-packages\win32com\client\dynamic.py", line 496,
in __getattr__
    raise AttributeError, "%s.%s" % (self._username_, attr)
AttributeError: DataCellArray.SetHAlignAt

At least my computer does not died.

Thanks

Auberth Eduardo Hurtado