Global name "userid" not defined??

Sean Berry sean_berry at cox.net
Tue Mar 30 17:53:47 CEST 2004


How do I rectify this?

------vars.py------

#!/usr/local/bin/python

def setUserid(value):
    userid = value

def getUserid():
    return userid

--------------------

>>>import vars
>>>vars.setUserid("Sean")
>>>vars.getUserid()

Then I get a Traceback error and the last line says:
NameError: name 'userid' is not defined

How do I make a variable global?

Sorry about the easy question... but I don't have all that much experience
in Python.





More information about the Python-list mailing list