|
Dear all,
I'm trying to use python to export tables to Excel but keep getting the error message below. Could anybody help me to understand what's going wrong? Thanks a lot, michaela 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 ? File "C:\Python24\lib\site-packages\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes ________________________________ From: Michaëla Stubbers Sent: 03 April 2008 17:18 To: 'Support - Belgium' Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Blijf dezelfde foutenmelding krijgen. Mis ik nog iets? Dankuwel, michaela 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 ? File "C:\Python24\lib\site-packages\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 03 April 2008 14:52 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Afgaande op de informatie in onderstaande mail, heeft U de gedownloade python modules niet in de juiste directory bewaard. Ik zie als path voor viewer.py het volgende staan : C:\Documents and Settings\ms\Desktop\viewer.py maar volgens de documentatie dient deze bewaard te worden in C:\Python24\Lib\site-packages. Zou het mogelijk zijn om dit eerst even na te kijken ? De 3 modules die U afhaalde van de Devcentral site, zouden in de site-packages folder moeten bewaard worden. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: donderdag 3 april 2008 12:30 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Ik heb onderstaande stappen gevolgd en ondertussen ook "pywin32-210.win32-py2.4.exe" geinstalleerd maar blijf onderstaande foutmelding krijgen. Moet ik nog meerdere modules installeren? Alvast bedankt! michaela "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 ? File "C:\Documents and Settings\ms\Desktop\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes" ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 01 April 2008 15:24 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Ik heb het python script uitgeprobeerd en dit lijkt te werken. Ik kan U de stappen meegeven die U dient uit te voeren om een python script uit te voeren vanuit SPSS maar op het script zelf geven we geen support. John Peck is de scripting verantwoordelijke binnen SPSS en voor problemen met het python script, kan U terecht op de Devcentral site. Om python scripts te kunnen gebruiken dient U volgende stappen te doorlopen : - Installatie van Python 2.4.3 vanaf de SPSS 15 installatie cd - Installatie van de Python plug-in vanaf de SPSS 15 installatie cd Daarnaast dient U specifieke python modules op uw machine te installeren, extra info hierover kan U vinden op http://www.spss.com/devcentral/index.cfm?pg=articleDet&artId=2 De modules zelf kan U downloaden vanaf volgende locaties: http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=1 http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=2 http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=9 Eens U bovenstaande stappen heeft doorlopen, kan U de python code uitvoeren vanaf de syntax editor. Open het syntax bestand en klik op Run > All. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: vrijdag 28 maart 2008 14:39 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) SPSSX-L Zie mails onder: Besides the Python approach, there are SaxBasic ways of exporting to Excel. There is a downloadable script, Excel Export, on SPSS Developer Central (www.spss.com/devcentral) that does this. That script does put up a dialog box, but the underlying automation method can be used syntactically. But, in SPSS 14 and 15, if you have installed the Python plugin and the win32com module, exporting all your visible tables to an Excel file is as simple as this. Just change the file location to what you want (note the use of forward slashes in the filespec). begin program. import spss, viewer app = viewer.spssapp() app.ExportDesignatedOutput(filespec='c:/temp/myoutput.xls',format='Excel') end program. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jarrod Teo Sent: Wednesday, January 09, 2008 2:40 AM To: [hidden email] Subject: [SPSSX-L] Exporting output to a file using a syntax command Hi anyone out there, Currently I want to export a table from my output into an excel file. I need a syntax command to do this; can someone help me on this? Much thanks. ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 28 March 2008 14:31 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Kan U even meegeven via welke mailing list U de informatie over het python script heeft ontvangen ? Is dit een mailing lijst die van SPSS zelf uit gaat ? Vanuit Support kan ik U op dit moment namelijk enkel de oplossing via het script aanbieden. Wat betreft andere klanten : dit probleem werd veelvuldig gemeld door klanten die SPSS 15 gebruikten en daarom is er de oplossing gekomen via het script. Inmiddels is SPSS 16 op de markt en hiermee loopt de export wel correct. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: donderdag 27 maart 2008 11:42 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Onderstaand script vormt voor ons echt geen oplossing daar we met grote tabellenboeken werken en het zeer onhandig is indien elke tabel in een andere sheet terechtkomt. Verder begint het script automatisch nieuwe excel files te genereren na x- aantal tabellen in 1 file weggeschreven te hebben. Ik ben op de hoogte van de andere bestaande scripts (ExportTablesToSingleExcelSheetV4.sbs) maar ook deze vormen geen oplossing daar de layout verloren gaat en we de resulterende tabellen op deze manier echt niet naar de klant kunnen sturen. Hoe gaan anderen met dit probleem om? Ik heb op de mailing list ook iets gelezen over een omweg via python, kunt u mij daar misschien iets meer over laten weten? Alvast bedankt, Michaela Stubbers ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 26 March 2008 14:17 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Ik heb uw vraag doorgekregen van mijn collega van eerstelijns support en ik zal deze verder opvolgen. De problemen bij het exporteren naar Excel formaat zijn ons bekend en deze werden verholpen in SPSS 16.0.1. In SPSS 15 kan U dit probleem omzeilen door gebruik te maken van een script. De download locatie voor dit script vindt U in onderstaande resolutie. Ik heb het hiernet even uitgeprobeerd op de doorgestuurde output file en het resultaat lijkt mij correct (zie excel bestand in attachment). Om het zelfde resultaat te bekomen, dient U volgende stappen te doorlopen : - Open het output bestand in de output viewer - Klik in het menu op Utilities > Run script - Kies hier voor het script "ExportTablesToExcelFiles.sbs" - U zal een keuze menu te zien krijgen, hier dient U enkel de lokatie van het nieuwe excel bestand aan te duiden (zie export.jpg) - Wanneer U op de OK knop klikt, zal het bestand aangemaakt worden. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> We have Resolution 68917 on file for this issue. Problem Summary: Exporting tables with mixed nested dimensions may result with misaligned column labels Problem Description: I am trying to export tables from the SPSS 15.0.x or SPSS 16 for Windows Viewer window to HTML, Excel, Word, or Powerpoint. This can also occur if I copy and paste. Regardless of what format I've selected to export to, some tables result with misaligned column labels. Why is this happening? Resolution Summary: This has been corrected in 16.0.1 Resolution Description: This was a defect and has been corrected in version 16.0.1. An interim scripting fix for Export to Excel is available from our FTP site. Please extract the file found here: ftp://ftp.spss.com/pub/spss/windows/ExportTablesToExcelFiles.zip. Instructions for use are also found in this compressed file. Another viable workaround for the time being is to use OMS to direct your output to HTML. Applications such as Excel, Word and Powerpoint are capable of reading HTML directly. For details on how to set up OMS please refer to Command Syntax Reference in SPSS Help menu, on page: 1234. A sample bit of command syntax would be as follows: OMS /SELECT Charts Texts Logs Warnings Tables Headings Trees /DESTINATION FORMAT=HTML OUTFILE='c:\test.htm'. This command syntax should be run prior to running the analysis. You would then close the OMS procedure and actually execute the export by issuing the OMSEND command: OMSEND. We apologize for any inconvenience. ====================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 |
|
It appears that you do not have the full win32com package installed. That would normally be okay if you installed the win32com extensions at all, so something may have gone wrong with that installation. Please try reinstalling the win32com libraries - as it says, be sure to get the Python 2.4 version. Be sure, also, to register the SPSS type libraries using the COM makepy menu under Tools in Pythonwin if you have not already done that.
HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Michaëla Stubbers Sent: Thursday, May 08, 2008 7:12 AM To: [hidden email] Subject: [SPSSX-L] export to excel using python Dear all, I'm trying to use python to export tables to Excel but keep getting the error message below. Could anybody help me to understand what's going wrong? Thanks a lot, michaela 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 ? File "C:\Python24\lib\site-packages\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes ________________________________ From: Michaëla Stubbers Sent: 03 April 2008 17:18 To: 'Support - Belgium' Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Blijf dezelfde foutenmelding krijgen. Mis ik nog iets? Dankuwel, michaela 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 ? File "C:\Python24\lib\site-packages\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 03 April 2008 14:52 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Afgaande op de informatie in onderstaande mail, heeft U de gedownloade python modules niet in de juiste directory bewaard. Ik zie als path voor viewer.py het volgende staan : C:\Documents and Settings\ms\Desktop\viewer.py maar volgens de documentatie dient deze bewaard te worden in C:\Python24\Lib\site-packages. Zou het mogelijk zijn om dit eerst even na te kijken ? De 3 modules die U afhaalde van de Devcentral site, zouden in de site-packages folder moeten bewaard worden. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: donderdag 3 april 2008 12:30 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Ik heb onderstaande stappen gevolgd en ondertussen ook "pywin32-210.win32-py2.4.exe" geinstalleerd maar blijf onderstaande foutmelding krijgen. Moet ik nog meerdere modules installeren? Alvast bedankt! michaela "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 ? File "C:\Documents and Settings\ms\Desktop\viewer.py", line 47, in ? import pythoncom, win32com.client File "C:\Python24\Lib\site-packages\pythoncom.py", line 2, in ? import pywintypes ImportError: No module named pywintypes" ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 01 April 2008 15:24 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Ik heb het python script uitgeprobeerd en dit lijkt te werken. Ik kan U de stappen meegeven die U dient uit te voeren om een python script uit te voeren vanuit SPSS maar op het script zelf geven we geen support. John Peck is de scripting verantwoordelijke binnen SPSS en voor problemen met het python script, kan U terecht op de Devcentral site. Om python scripts te kunnen gebruiken dient U volgende stappen te doorlopen : - Installatie van Python 2.4.3 vanaf de SPSS 15 installatie cd - Installatie van de Python plug-in vanaf de SPSS 15 installatie cd Daarnaast dient U specifieke python modules op uw machine te installeren, extra info hierover kan U vinden op http://www.spss.com/devcentral/index.cfm?pg=articleDet&artId=2 De modules zelf kan U downloaden vanaf volgende locaties: http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=1 http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=2 http://www.spss.com/devcentral/index.cfm?pg=downloadDet&dId=9 Eens U bovenstaande stappen heeft doorlopen, kan U de python code uitvoeren vanaf de syntax editor. Open het syntax bestand en klik op Run > All. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: vrijdag 28 maart 2008 14:39 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) SPSSX-L Zie mails onder: Besides the Python approach, there are SaxBasic ways of exporting to Excel. There is a downloadable script, Excel Export, on SPSS Developer Central (www.spss.com/devcentral) that does this. That script does put up a dialog box, but the underlying automation method can be used syntactically. But, in SPSS 14 and 15, if you have installed the Python plugin and the win32com module, exporting all your visible tables to an Excel file is as simple as this. Just change the file location to what you want (note the use of forward slashes in the filespec). begin program. import spss, viewer app = viewer.spssapp() app.ExportDesignatedOutput(filespec='c:/temp/myoutput.xls',format='Excel') end program. HTH, Jon Peck -----Original Message----- From: SPSSX(r) Discussion [mailto:[hidden email]] On Behalf Of Jarrod Teo Sent: Wednesday, January 09, 2008 2:40 AM To: [hidden email] Subject: [SPSSX-L] Exporting output to a file using a syntax command Hi anyone out there, Currently I want to export a table from my output into an excel file. I need a syntax command to do this; can someone help me on this? Much thanks. ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 28 March 2008 14:31 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Kan U even meegeven via welke mailing list U de informatie over het python script heeft ontvangen ? Is dit een mailing lijst die van SPSS zelf uit gaat ? Vanuit Support kan ik U op dit moment namelijk enkel de oplossing via het script aanbieden. Wat betreft andere klanten : dit probleem werd veelvuldig gemeld door klanten die SPSS 15 gebruikten en daarom is er de oplossing gekomen via het script. Inmiddels is SPSS 16 op de markt en hiermee loopt de export wel correct. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> ________________________________ From: Michaëla Stubbers [mailto:[hidden email]] Sent: donderdag 27 maart 2008 11:42 To: Support - Belgium Subject: RE: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste, Onderstaand script vormt voor ons echt geen oplossing daar we met grote tabellenboeken werken en het zeer onhandig is indien elke tabel in een andere sheet terechtkomt. Verder begint het script automatisch nieuwe excel files te genereren na x- aantal tabellen in 1 file weggeschreven te hebben. Ik ben op de hoogte van de andere bestaande scripts (ExportTablesToSingleExcelSheetV4.sbs) maar ook deze vormen geen oplossing daar de layout verloren gaat en we de resulterende tabellen op deze manier echt niet naar de klant kunnen sturen. Hoe gaan anderen met dit probleem om? Ik heb op de mailing list ook iets gelezen over een omweg via python, kunt u mij daar misschien iets meer over laten weten? Alvast bedankt, Michaela Stubbers ________________________________ From: Support - Belgium [mailto:[hidden email]] Sent: 26 March 2008 14:17 To: Michaëla Stubbers Subject: SPSS CaseID : JM/564139 - Exporting to excel 2003 is not possible (with SPSS14 no problems) Beste mevrouw Stubbers, Ik heb uw vraag doorgekregen van mijn collega van eerstelijns support en ik zal deze verder opvolgen. De problemen bij het exporteren naar Excel formaat zijn ons bekend en deze werden verholpen in SPSS 16.0.1. In SPSS 15 kan U dit probleem omzeilen door gebruik te maken van een script. De download locatie voor dit script vindt U in onderstaande resolutie. Ik heb het hiernet even uitgeprobeerd op de doorgestuurde output file en het resultaat lijkt mij correct (zie excel bestand in attachment). Om het zelfde resultaat te bekomen, dient U volgende stappen te doorlopen : - Open het output bestand in de output viewer - Klik in het menu op Utilities > Run script - Kies hier voor het script "ExportTablesToExcelFiles.sbs" - U zal een keuze menu te zien krijgen, hier dient U enkel de lokatie van het nieuwe excel bestand aan te duiden (zie export.jpg) - Wanneer U op de OK knop klikt, zal het bestand aangemaakt worden. Met vriendelijke groet, Jan Mostrey - Technical support SPSS Inc. Email: [hidden email] <mailto:[hidden email]> We have Resolution 68917 on file for this issue. Problem Summary: Exporting tables with mixed nested dimensions may result with misaligned column labels Problem Description: I am trying to export tables from the SPSS 15.0.x or SPSS 16 for Windows Viewer window to HTML, Excel, Word, or Powerpoint. This can also occur if I copy and paste. Regardless of what format I've selected to export to, some tables result with misaligned column labels. Why is this happening? Resolution Summary: This has been corrected in 16.0.1 Resolution Description: This was a defect and has been corrected in version 16.0.1. An interim scripting fix for Export to Excel is available from our FTP site. Please extract the file found here: ftp://ftp.spss.com/pub/spss/windows/ExportTablesToExcelFiles.zip. Instructions for use are also found in this compressed file. Another viable workaround for the time being is to use OMS to direct your output to HTML. Applications such as Excel, Word and Powerpoint are capable of reading HTML directly. For details on how to set up OMS please refer to Command Syntax Reference in SPSS Help menu, on page: 1234. A sample bit of command syntax would be as follows: OMS /SELECT Charts Texts Logs Warnings Tables Headings Trees /DESTINATION FORMAT=HTML OUTFILE='c:\test.htm'. This command syntax should be run prior to running the analysis. You would then close the OMS procedure and actually execute the export by issuing the OMSEND command: OMSEND. We apologize for any inconvenience. ======= 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 |
| Free forum by Nabble | Edit this page |
