Forum Discussion

melanieKno's avatar
melanieKno
Occasional Contributor
2 years ago

Runtime error while assigning project variable

I have this code inside my script, fetching the values for "user" and "pwd" from a form:
------------------------------------------------
if mr == mrOk:
   user = idField.Text
   pwd = pwdField.Text

   if not Project.Variables.VariableExists("vpmUser"):
      Project.Variables.AddVariable("vpmUser", "String")
   if not Project.Variables.VariableExists("vpmPassword"):
      Project.Variables.AddVariable("vpmPassword", "Password")

   Project.Variables.vpmUser = user
   Project.Variables.vmpPassword = pwd

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

The first assignment for user is working, but for assigning "pwd" in the last line I get a "Python runtime error. AttributeError: The object does not support this property or method. [...]". Why does it work for the user, but not for the password? When I check the project variables inside my project the value for vpmUser is set correctly, the value of vpmPassword is empty.

2 Replies