>>>>> [EMAIL PROTECTED] (b) wrote:

>b> I have been a long time Matlab user. I Python, I miss Matlab's whos
>b> command.

>b> So I have written a little utility whos.py, which can be downloaded
>b> here:
>b> http://beluga.eos.ubc.ca/~tang/softwares/python/

>b> Here is the doc string:

>b> # Before using whos, do:
>b> execfile('whos.py')

>>> execfile('whos.py')
>>> whos()
Traceback (most recent call last):
  File "<stdin>", line 1, in ?
  File "whos.py", line 142, in whos
    iType1 = string.split(str(iType), "'")[1]
NameError: global name 'string' is not defined

Using execfile is a bad way to get the function definition. Import is the
way to go. Just add a line:
import string
to the beginning of whos.py, and the the usage should be:

from whos import whos
whos()

or 
import whos
whos.whos()
-- 
Piet van Oostrum <[EMAIL PROTECTED]>
URL: http://www.cs.uu.nl/~piet [PGP]
Private email: [EMAIL PROTECTED]
-- 
http://mail.python.org/mailman/listinfo/python-list

Reply via email to