Hello everybody
I've created the following syntax (see below), which works fine without the lines used by python. When I run it with the python lines I get the following error can anybody clearify the problem. thanks nico *************************************** Traceback (most recent call last): File "", line 29, in File "", line 7 if r'C:\Users ^ SyntaxError: EOL while scanning string literal ************************************************ BEGIN PROGRAM. import spss spss.Submit(r""" CTABLES /VLABELS VARIABLES=v11_1 v11_2 v11_3 v11_4 v11_5 DISPLAY=NONE /VLABELS VARIABLES=vcomp DISPLAY=none /TABLE v11_1 [C] + v11_2 [C] + v11_3 [C] + v11_4 [C] + v11_5 [C] BY vcomp [C][COLPCT.COUNT PCT40.1] /CATEGORIES VARIABLES=v11_1 v11_2 v11_3 v11_4 v11_5 [1, 2, OTHERNM] EMPTY=EXCLUDE /CATEGORIES VARIABLES=vcomp ORDER=A KEY=VALUE EMPTY=EXCLUDE /SLABELS POSITION=column VISIBLE=NO. SPSSINC MODIFY TABLES subtype="Custom Table" SELECT=neen DIMENSION= ROWS LEVEL = -1 PROCESS = ALL HIDE=TRUE /STYLES APPLYTO=DATACELLS. OUTPUT EXPORT /XLSX DOCUMENTFILE= 'C:\spss14\2\gezin_e_tabel.xlsx' . OUTPUT CLOSE *. """) END PROGRAM. |
I'm not sure we are seeing all the code
involved, but in this line
/XLSX DOCUMENTFILE= 'C:\spss14\2\gezin_e_tabel.xlsx' . the \ sequences are interpreted by Python as escape sequences when they match certain codes. In particular, \2 turns into a control code character. You can either prefix the entire triple-quoted literal with r to prevent that interpretation, or use forward slashes in the path, or double the backslashes. I prefer the r prefix (for raw), so it would look like r""" ... Jon Peck (no "h") aka Kim Senior Software Engineer, IBM [hidden email] phone: 720-342-5621 From: NicoDW <[hidden email]> To: [hidden email] Date: 01/22/2015 12:50 PM Subject: [SPSSX-L] problem with convertion of modify tables into python Sent by: "SPSSX(r) Discussion" <[hidden email]> Hello everybody I've created the following syntax (see below), which works fine without the lines used by python. When I run it with the python lines I get the following error can anybody clearify the problem. thanks nico *************************************** Traceback (most recent call last): File "", line 29, in File "", line 7 if r'C:\Users ^ SyntaxError: EOL while scanning string literal ************************************************ BEGIN PROGRAM. import spss spss.Submit(r""" CTABLES /VLABELS VARIABLES=v11_1 v11_2 v11_3 v11_4 v11_5 DISPLAY=NONE /VLABELS VARIABLES=vcomp DISPLAY=none /TABLE v11_1 [C] + v11_2 [C] + v11_3 [C] + v11_4 [C] + v11_5 [C] BY vcomp [C][COLPCT.COUNT PCT40.1] /CATEGORIES VARIABLES=v11_1 v11_2 v11_3 v11_4 v11_5 [1, 2, OTHERNM] EMPTY=EXCLUDE /CATEGORIES VARIABLES=vcomp ORDER=A KEY=VALUE EMPTY=EXCLUDE /SLABELS POSITION=column VISIBLE=NO. SPSSINC MODIFY TABLES subtype="Custom Table" SELECT=neen DIMENSION= ROWS LEVEL = -1 PROCESS = ALL HIDE=TRUE /STYLES APPLYTO=DATACELLS. OUTPUT EXPORT /XLSX DOCUMENTFILE= 'C:\spss14\2\gezin_e_tabel.xlsx' . OUTPUT CLOSE *. """) END PROGRAM. -- View this message in context: http://spssx-discussion.1045642.n5.nabble.com/problem-with-convertion-of-modify-tables-into-python-tp5728457.html Sent from the SPSSX Discussion mailing list archive at Nabble.com. ===================== 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 |