|
Hello,
I have just installed SPSS 16 and Python 2.5 with several modules and plug-ins. I have then tried this very interesting piece of code (slightly adapted from Jon Peck's Programmability slides I have downloaded from HYPERLINK "http://www.spss.com/devcentral/"www.spss.com/devcentral/): GET FILE "C:\Programmi\SPSSInc\SPSS16\Samples\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE JOBCAT BY GENDER /TITLES TITLE='JOB CATEGORY BY GENDER' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd, autofit=False) END PROGRAM. Unfortunately I get the following error: This module requires pythoncom and win32com.client modules, which can be downloaded from http://sourceforge.net/projects/pywin32/ Be sure to get the Python 2.4 version. Traceback (most recent call last): File "<string>", line 2, in <module> File "C:\Python25\lib\site-packages\tables.py", line 130, in <module> import spss, viewer, sys File "C:\Python25\lib\site-packages\viewer.py", line 47, in <module> import pythoncom, win32com.client File "C:\Python25\Lib\site-packages\pythoncom.py", line 2, in <module> import pywintypes File "C:\Python25\lib\site-packages\pywintypes.py", line 102, in <module> __import_pywin32_system_module__("pywintypes", globals()) File "C:\Python25\lib\site-packages\pywintypes.py", line 64, in __import_pywin32_system_module__ import _win32sysloader ImportError: No module named _win32sysloader Please notice that I have uploaded the python client modules, and it looks like the more module I add the more there are other modules needed... Can anyone assist me on this one? Thanks, Luca Mr. Luca MEYER Market research, data analysis & more HYPERLINK "http://www.lucameyer.com/"www.lucameyer.com - Tel: +39.339.495.00.21 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
The viewer and tables modules are currently not available for SPSS 16 due to architectural changes in the product. New versions are under development that will take advantage of the SpssClient apis instead of using the COM interfaces. This will eliminate the need for the win32com com libraries required with previous versions. The new versions will be portable across Windows, Mac, and Linux.
HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Luca Meyer Sent: Tuesday, January 08, 2008 2:18 PM To: [hidden email] Subject: [SPSSX-L] Python code error Hello, I have just installed SPSS 16 and Python 2.5 with several modules and plug-ins. I have then tried this very interesting piece of code (slightly adapted from Jon Peck's Programmability slides I have downloaded from HYPERLINK "http://www.spss.com/devcentral/"www.spss.com/devcentral/): GET FILE "C:\Programmi\SPSSInc\SPSS16\Samples\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE JOBCAT BY GENDER /TITLES TITLE='JOB CATEGORY BY GENDER' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd, autofit=False) END PROGRAM. Unfortunately I get the following error: This module requires pythoncom and win32com.client modules, which can be downloaded from http://sourceforge.net/projects/pywin32/ Be sure to get the Python 2.4 version. Traceback (most recent call last): File "<string>", line 2, in <module> File "C:\Python25\lib\site-packages\tables.py", line 130, in <module> import spss, viewer, sys File "C:\Python25\lib\site-packages\viewer.py", line 47, in <module> import pythoncom, win32com.client File "C:\Python25\Lib\site-packages\pythoncom.py", line 2, in <module> import pywintypes File "C:\Python25\lib\site-packages\pywintypes.py", line 102, in <module> __import_pywin32_system_module__("pywintypes", globals()) File "C:\Python25\lib\site-packages\pywintypes.py", line 64, in __import_pywin32_system_module__ import _win32sysloader ImportError: No module named _win32sysloader Please notice that I have uploaded the python client modules, and it looks like the more module I add the more there are other modules needed... Can anyone assist me on this one? Thanks, Luca Mr. Luca MEYER Market research, data analysis & more HYPERLINK "http://www.lucameyer.com/"www.lucameyer.com - Tel: +39.339.495.00.21 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
Hello Jon,
I have tried to run your syntax under SPSS 15 (15.0.1) and I get a partial result. Can you shade some lights for me on why this might be occurring: SYNTAX: GET FILE "C:\Programmi\SPSS\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE jobcat BY gender /TITLES TITLE='Job categories by gender' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd) END PROGRAM. OUTPUT: <--- some tables with only the first cell (first row, first column) correctly reported ---> Traceback (most recent call last): File "<string>", line 5, 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) Thank you, Luca Mr. Luca MEYER Market research, data analysis & more www.lucameyer.com - Tel: +39.339.495.00.21 -----Messaggio originale----- Da: Luca Meyer [mailto:[hidden email]] Inviato: mercoledì 9 gennaio 2008 22.24 A: 'Peck, Jon' Oggetto: R: [SPSSX-L] Python code error Thanks Jon I will try to run it under SPSS 15 that I still have running on my machine. Luca -----Messaggio originale----- Da: Peck, Jon [mailto:[hidden email]] Inviato: mercoledì 9 gennaio 2008 18.13 A: Luca Meyer; [hidden email] Oggetto: RE: [SPSSX-L] Python code error The viewer and tables modules are currently not available for SPSS 16 due to architectural changes in the product. New versions are under development that will take advantage of the SpssClient apis instead of using the COM interfaces. This will eliminate the need for the win32com com libraries required with previous versions. The new versions will be portable across Windows, Mac, and Linux. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Luca Meyer Sent: Tuesday, January 08, 2008 2:18 PM To: [hidden email] Subject: [SPSSX-L] Python code error Hello, I have just installed SPSS 16 and Python 2.5 with several modules and plug-ins. I have then tried this very interesting piece of code (slightly adapted from Jon Peck's Programmability slides I have downloaded from HYPERLINK "http://www.spss.com/devcentral/"www.spss.com/devcentral/): GET FILE "C:\Programmi\SPSSInc\SPSS16\Samples\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE JOBCAT BY GENDER /TITLES TITLE='JOB CATEGORY BY GENDER' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd, autofit=False) END PROGRAM. Unfortunately I get the following error: This module requires pythoncom and win32com.client modules, which can be downloaded from http://sourceforge.net/projects/pywin32/ Be sure to get the Python 2.4 version. Traceback (most recent call last): File "<string>", line 2, in <module> File "C:\Python25\lib\site-packages\tables.py", line 130, in <module> import spss, viewer, sys File "C:\Python25\lib\site-packages\viewer.py", line 47, in <module> import pythoncom, win32com.client File "C:\Python25\Lib\site-packages\pythoncom.py", line 2, in <module> import pywintypes File "C:\Python25\lib\site-packages\pywintypes.py", line 102, in <module> __import_pywin32_system_module__("pywintypes", globals()) File "C:\Python25\lib\site-packages\pywintypes.py", line 64, in __import_pywin32_system_module__ import _win32sysloader ImportError: No module named _win32sysloader Please notice that I have uploaded the python client modules, and it looks like the more module I add the more there are other modules needed... Can anyone assist me on this one? Thanks, Luca Mr. Luca MEYER Market research, data analysis & more HYPERLINK "http://www.lucameyer.com/"www.lucameyer.com - Tel: +39.339.495.00.21 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.2/1223 - Release Date: 13/01/2008 20.23 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
|
This indicates that you have not set up the COM connection correctly. Using Pythonwin, go to Tools/COM Makepy utility.
Find the SPSS pivot table library in the window that appears. Select it and press Close. All will be well. The user interface for that window is deceptive. It allows multiple selection of libraries, but it only processes the first one in the selection. HTH, Jon Peck -----Original Message----- From: Luca Meyer [mailto:[hidden email]] Sent: Monday, January 14, 2008 7:48 AM To: Peck, Jon Cc: [hidden email] Subject: R: [SPSSX-L] Python code error Hello Jon, I have tried to run your syntax under SPSS 15 (15.0.1) and I get a partial result. Can you shade some lights for me on why this might be occurring: SYNTAX: GET FILE "C:\Programmi\SPSS\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE jobcat BY gender /TITLES TITLE='Job categories by gender' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd) END PROGRAM. OUTPUT: <--- some tables with only the first cell (first row, first column) correctly reported ---> Traceback (most recent call last): File "<string>", line 5, 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) Thank you, Luca Mr. Luca MEYER Market research, data analysis & more www.lucameyer.com - Tel: +39.339.495.00.21 -----Messaggio originale----- Da: Luca Meyer [mailto:[hidden email]] Inviato: mercoledì 9 gennaio 2008 22.24 A: 'Peck, Jon' Oggetto: R: [SPSSX-L] Python code error Thanks Jon I will try to run it under SPSS 15 that I still have running on my machine. Luca -----Messaggio originale----- Da: Peck, Jon [mailto:[hidden email]] Inviato: mercoledì 9 gennaio 2008 18.13 A: Luca Meyer; [hidden email] Oggetto: RE: [SPSSX-L] Python code error The viewer and tables modules are currently not available for SPSS 16 due to architectural changes in the product. New versions are under development that will take advantage of the SpssClient apis instead of using the COM interfaces. This will eliminate the need for the win32com com libraries required with previous versions. The new versions will be portable across Windows, Mac, and Linux. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Luca Meyer Sent: Tuesday, January 08, 2008 2:18 PM To: [hidden email] Subject: [SPSSX-L] Python code error Hello, I have just installed SPSS 16 and Python 2.5 with several modules and plug-ins. I have then tried this very interesting piece of code (slightly adapted from Jon Peck's Programmability slides I have downloaded from HYPERLINK "http://www.spss.com/devcentral/"www.spss.com/devcentral/): GET FILE "C:\Programmi\SPSSInc\SPSS16\Samples\Employee data.sav". BEGIN PROGRAM. import spss, tables cmd=r"""CTABLES /TABLE JOBCAT BY GENDER /TITLES TITLE='JOB CATEGORY BY GENDER' /COMPARETEST TYPE=PROP""" tables.mergeLatest(cmd, autofit=False) END PROGRAM. Unfortunately I get the following error: This module requires pythoncom and win32com.client modules, which can be downloaded from http://sourceforge.net/projects/pywin32/ Be sure to get the Python 2.4 version. Traceback (most recent call last): File "<string>", line 2, in <module> File "C:\Python25\lib\site-packages\tables.py", line 130, in <module> import spss, viewer, sys File "C:\Python25\lib\site-packages\viewer.py", line 47, in <module> import pythoncom, win32com.client File "C:\Python25\Lib\site-packages\pythoncom.py", line 2, in <module> import pywintypes File "C:\Python25\lib\site-packages\pywintypes.py", line 102, in <module> __import_pywin32_system_module__("pywintypes", globals()) File "C:\Python25\lib\site-packages\pywintypes.py", line 64, in __import_pywin32_system_module__ import _win32sysloader ImportError: No module named _win32sysloader Please notice that I have uploaded the python client modules, and it looks like the more module I add the more there are other modules needed... Can anyone assist me on this one? Thanks, Luca Mr. Luca MEYER Market research, data analysis & more HYPERLINK "http://www.lucameyer.com/"www.lucameyer.com - Tel: +39.339.495.00.21 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD No virus found in this incoming message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.17.13/1213 - Release Date: 07/01/2008 9.14 No virus found in this outgoing message. Checked by AVG Free Edition. Version: 7.5.516 / Virus Database: 269.19.2/1223 - Release Date: 13/01/2008 20.23 ===================== To manage your subscription to SPSSX-L, send a message to [hidden email] (not to SPSSX-L), with no body text except the command. To leave the list, send the command SIGNOFF SPSSX-L For a list of commands to manage subscriptions, send the command INFO REFCARD |
| Free forum by Nabble | Edit this page |
