User Data import to LMS system

was not able to import a new user with data import show error like

Traceback (most recent call last):
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 149, in import_data
doc = self.process_doc(doc)
^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 251, in process_doc
return self.insert_record(doc)
^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 270, in insert_record
new_doc.insert()
File “apps/frappe/frappe/model/document.py”, line 334, in insert
self.run_post_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1177, in run_post_save_methods
self.run_method(“on_update”)
File “apps/frappe/frappe/model/document.py”, line 1011, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1371, in composer
return composed(self, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1353, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1008, in fn
return method_object(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/core/doctype/user/user.py”, line 230, in on_update
self.send_password_notification(self.__new_password)
File “apps/frappe/frappe/core/doctype/user/user.py”, line 356, in send_password_notification
self.send_welcome_mail_to_user()
File “apps/frappe/frappe/core/doctype/user/user.py”, line 426, in send_welcome_mail_to_user
self.send_login_mail(
File “apps/frappe/frappe/core/doctype/user/user.py”, line 466, in send_login_mail
frappe.sendmail(
File “apps/frappe/frappe/_init_.py”, line 804, in sendmail
return builder.process(send_now=now)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 753, in process
queue_data = self.as_dict(include_recipients=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 798, in as_dict
mail = self.prepare_email_content()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 716, in prepare_email_content
sender=self.sender,
^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 607, in sender
return email_account.default_sender
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 342, in default_sender
return email.utils.formataddr((self.name, self.get(“email_id”)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/home/frappe/.pyenv/versions/3.11.6/lib/python3.11/email/utils.py”, line 91, in formataddr
address.encode(‘ascii’)
^^^^^^^^^^^^^^
AttributeError: ‘NoneType’ object has no attribute ‘encode’

my data was fairly simple with only a single row

data:

ID Email First Name Acceptance for Terms and/or Policies User Type Username Country Full Name Last Name ID (Roles Assigned) Role (Roles Assigned)
importstudent@gmail.com import 1 Website User import_student india import_student LMS Student

could anybody help on this , i really cannot import data.

@advaith Do you have an email account set up? When creating a user, “Send Welcome Email” is enabled by default. So the system is trying to send an email, and that’s where the flow is breaking. The error message could have been better here.

If you want to skip the email step then add a column in your import file where Send Welcome Email is set to 0

Thank you , but i think if if that was a mandotary field , you could have mentioned it in the data import template itself.