Date: Thu, 15 Jul 2010 10:43:35 +0000
Reply-To: Ruben van den Berg <ruben_van_den_berg@hotmail.com>
Sender: "SPSSX(r) Discussion" <SPSSX-L@LISTSERV.UGA.EDU>
From: Ruben van den Berg <ruben_van_den_berg@hotmail.com>
Subject: Re: Difference between Python program block and equivalent
command in IDLE
In-Reply-To: <67981.52320.qm@web110701.mail.gq1.yahoo.com>
Content-Type: multipart/alternative;
Hi Albert-Jan (and others),
Thank you but I think this is even more complicated. If I run
begin program.
import spss,spssdata
end program.
begin program.
help(cursor)
end program.
I get an error. However, by running (some Python 'borrowed' from Jon Peck)
dataset close all.
cd'C:\Program Files\SPSSInc\PASWStatistics18\Samples\English'.
get file'1991 U.S. General Social Survey.sav'.
dataset name gss.
begin program.
import spss,spssdata
rowvar="life"
colvar="happy"
cursor=spssdata.Spssdata(colvar,omitmissing=True)
allvalues=set([case[0] for case in cursor])
print allvalues
end program.
begin program.
help(cursor)
end program.
I get help on an spssdata object. I guess it's the program block that 'activates' or invokes the help function.
Best,
Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: ruben.van.den.berg@tns-nipo.com
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com
Date: Thu, 15 Jul 2010 01:57:41 -0700
From: fomcl@yahoo.com
Subject: Re: Difference between Python program block and equivalent command in IDLE
To: SPSSX-L@LISTSERV.UGA.EDU
Hi,
It seems that SPSS already imports some modules "under the hood". I bet Jon can tell you more about that.
if you type
import spss
help(spss.cursor)
It might work (can't test it here)
If the above works,
spss.cursor.__doc__
will also show the docstring.
Cheers!!
Albert-Jan
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
All right, but apart from the sanitation, the medicine, education, wine, public order, irrigation, roads, a fresh water system, and public health, what have the Romans ever done for us?
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~
--- On Thu, 7/15/10, Ruben van den Berg <ruben_van_den_berg@hotmail.com> wrote:
From: Ruben van den Berg <ruben_van_den_berg@hotmail.com>
Subject: [SPSSX-L] Difference between Python program block and equivalent command in IDLE
To: SPSSX-L@LISTSERV.UGA.EDU
Date: Thursday, July 15, 2010, 10:18 AM
Dear all,
Does anyone understand the following? If I run
begin program.
help(cursor)
end program.
in SPSS syntax, I get normal results. However, if I run
>>> help(cursor)
in IDLE, I only get the following error:
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
help(cursor)
NameError: name 'cursor' is not defined
I hope this is not a dumb question, but shouldn't these render the same result?
TIA!
Ruben van den Berg
Consultant Models & Methods
TNS NIPO
Email: ruben.van.den.berg@tns-nipo.com
Mobiel: +31 6 24641435
Telefoon: +31 20 522 5738
Internet: www.tns-nipo.com
New Windows 7: Find the right PC for you. Learn more.
_________________________________________________________________
New Windows 7: Simplify what you do everyday. Find the right PC for you.
http://windows.microsoft.com/shop
[text/html]