Error while creating user-defined functions with Python

classic Classic list List threaded Threaded
1 message Options
Reply | Threaded
Open this post in threaded view
|

Error while creating user-defined functions with Python

Luca Meyer
Hi,

I am learning Python using Raynald book's and I am facing some difficulties
when I try to create the user-defined functions.

More specifically, as suggested on pages 244-245 of the book I have created
the following Python module: http://www.lucameyer.com/samplelib.py and I
have saved in the directory C:\Python24\Lib\site-packages\samplelib.py

Afterwards I have run the following code:

*python_change_string_width.sps.
DATA LIST LIST /id(F8) type(A15).
BEGIN DATA
123 'Stilton'
267 'Jarlsberger'
103 'Danish Blue'
END DATA.

BEGIN PROGRAM.
Import spss
import samplelib
samplelib.ChangeStringWidth('type',30)
END PROGRAM.

And I get the following output:


No virus found in this outgoing message.
Checked by AVG Free Edition.
Version: 7.5.485 / Virus Database: 269.13.3/986 - Release Date: 03/09/2007
9.31