The problem seems to be with ipython, which I have been using to run these scripts. My calling script (call.py) is:
import canaryPlaces_test as canp sum=canp.addme(3,5) print sum estoc=canp.estocStn() print estoc The problem script is this one, named canaryPlaces_test.py: def estocStn(): estoc={'lat':29.15,'lon':-15.667,'place':'ESTOC'} return estoc def addme(a,b): sumAb=a+b return sumAb The ok script, named canaryPlaces.py, is identical apart from a comment at the top of one of them. Here is output from 'diff' for the two of them: @suse212:~/python/mapping> diff canaryPlaces_test.py canaryPlaces.py 1c1 < --- > # canaryPlaces [EMAIL PROTECTED]:~/python/mapping> >From the command line I get what I expect calling either canaryPlaces_test.py or canaryPlaces.py: @suse212:~/python/mapping> python call.py 8 {'lat': 29.149999999999999, 'place': 'ESTOC', 'lon': -15.667} [EMAIL PROTECTED]:~/python/mapping> However -> Using ipython and calling canaryPlaces.py is fine, but calling canaryPlaces_test.py gives: In [97]: %run call 8 --------------------------------------------------------------------------- exceptions.NameError Traceback (most recent call last) /home/evan/python/mapping/call.py 2 3 sum=canp.addme(3,5) 4 print sum ----> 5 estoc=canp.estocStn() 6 print estoc /home/evan/python/mapping/canaryPlaces_test.py in estocStn() 5 return estoc 6 7 def addme(a,b): 8 sumAb=a+b 9 return sumAb NameError: global name 'self' is not defined WARNING: Failure executing file: <call.py> In [98]: On my system this error is repeatable. -Evan Bjoern Schliessmann wrote: > Evan wrote: > > > So I have deleted the 'old' script2 and renamed the new one, and > > no problem. > > Pity. Next time try using diff (or something similar). > > Regards, > > > Björn > > -- > BOFH excuse #115: > > your keyboard's space bar is generating spurious keycodes. -- http://mail.python.org/mailman/listinfo/python-list