SPSS Statistics

 View Only
Expand all | Collapse all

spss.submit() affects preceding print() of unicode characters

  • 1.  spss.submit() affects preceding print() of unicode characters

    Posted Fri January 07, 2022 02:38 PM
    Edited by Frank Watzl Fri January 07, 2022 02:39 PM
      |   view attached
    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
    ------------------------------


  • 2.  RE: spss.submit() affects preceding print() of unicode characters

    Posted Mon January 10, 2022 12:01 PM
    Hello. We are not sure of the cause yet. A defect has been filed on this issue (#5335) and an engineer will be assigned to look at it shortly.

    Regards,

    ------------------------------
    Curtis Browning
    SPSS Statistics Architect
    ------------------------------