1
votes

I am trying to implement the 'MYFREQUENCIES' extension command as practice for my own extension command. I got the code for the implementation file (Python) and XML file from IBM's 'Programming and Data Management'. This is the Python code (saved as MYFREQUENCIES.py) :

import spss
def Run(args):
    varlist = args['MYFREQUENCIES'][''][0]['VARIABLES']
    varlist = " ".join(varlist)
    spss.Submit("FREQUENCIES /VARIABLES=%s /BARCHART /FORMAT=NOTABLE." %(varlist))

This is the XML file (MYFREQUENCIES.XML):

<Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="extension.xsd"
Name="MYFREQUENCIES" Language="Python">
<Subcommand Name="" Occurrence="Required" IsArbitrary="False">
<Parameter Name="VARIABLES" ParameterType="VariableNameList"/>
</Subcommand>
</Command>

However, when I install the extension bundle, I get the following error:

Command XML Error on line 1, column 63. Execution of this command stops". When I try to run the command, I get the error: "The first word in the line is not recognized as an SPSS Statistics command

What is wrong with the XML document?

I read somewhere that this has to do with whitespace that makes the command stop. But I am unable to figure out what to edit in my XML document, so that the extension command runs properly.

1

1 Answers

0
votes

Delete XML file from ProgramData\IBM\SPSS\Statistics\24\extensions, in your xml file delete EOL from 1st line. Command:

<Command xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"xsi:noNamespaceSchemaLocation="extension.xsd" Name="MYFREQUENCIES" Language="Python">

Should be without EOL symbol (in 1 line).

After that my extension works fine.