Dear all,
I have encountered a puzzling effect of Python's spss.submit() on the output of print().
In PROGRAM blocks containing a spss.submit() statement, unicode characters printed with print() will appear in the output as unicode codepoints. This is true even if the print() statement
precedes the spss.submit statement. In preceding and following PROGRAM blocks without spss.submit() statements, the unicode characters are printed correctly.
Is there an explanation or a workaround for this behavior?
* Encoding: UTF-8.
BEGIN PROGRAM PYTHON3.
#coding=utf-8
import spss, spssaux
print ('these statements will print fine:')
print ('├')
print('•')
END PROGRAM.
BEGIN PROGRAM PYTHON3.
#coding=utf-8
import spss, spssaux
print ('these statements will print unicode codepoints :')
print ('├')
print('•')
# The next statement requires a dataset with at least one variable in it;
# if there is no such dataset, the statement will produce an error;
# But either way: The mere presence of the spss.submit () statement
# will affect the output of the preceding (!) print() statements
spss.Submit ('COMPUTE newVar = 1.')
END PROGRAM.
BEGIN PROGRAM PYTHON3.
#coding=utf-8
import spss, spssaux
print ('\nthese statements will print fine again:')
print ('├')
print('•')
END PROGRAM.
------------------------------
Frank Watzl
------------------------------
#SPSSStatistics