【发布时间】:2019-05-25 03:25:00
【问题描述】:
我这样做已经有一段时间了。
在过去的两个月里一切都很好,并且突然出现了这个错误,“元素中的非字母字符,带有前导 alpha:”当试图在 firestore 上更新时。我什至不知道从哪里开始寻找问题。
# returns true if update was successful
def UpdateUser(self, user):
try:
# update will fail if it cant find an already existing document
doc_ref = self._db.collection(USER).document(user._username)
# update the values | this will fail if it doesn't exist
doc_ref.update({
u'Username': user._username,
u'Password': user._password,
# u'Time Created': user._time_created,
u'Last logged in': user._last_logged_in,
u'Active': user._active,
u'Phone': user._phone,
u'Address': user._address,
u'State': user._state,
u'City': user._city,
u'Zipcode': user._zipcode,
u'Stripe Customer Id': user._stripe_customer_id,
u'Email Activated': user._email_activated,
u'Full Name': user._full_name,
u'Id': user._id,
u'Group Ids': user._group_ids,
})
return True
except Exception as e:
print(e)
print("Failed to update {}".format(user._username))
return False
我希望输出是一次成功的更新,但它似乎抛出了一个错误。
【问题讨论】:
标签: python google-cloud-firestore