Data import error in user

I have been trying to import my user data but, it keeps showing :

No Roles Specified
Newly created user example@abc.org has no roles enabled.

I have already imported the “Roles” and “Role profile” data. Please help me figuring out this error.

Can you provide more details, perhaps screenshots of how you did it and what the result is?

first I exported the user data from develop mode and then i tried to import the same csv file in production. when i tried importing the data this error was being shown.

Hi @Alfiya_Hussain,

If you import User and you added a Role in Excel then Role must be enabled.
So please go to the Role list and check the status of Disabled.

Thank You!

@NCP I had enabled the roles.

Hi @Alfiya_Hussain,

Please click on Show Traceback and check the error in the Import Log section.

Thank You!

@NCP This is the traceback of the error.
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 243, in process_doc
return self.insert_record(doc)
^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/core/doctype/data_import/importer.py”, line 262, in insert_record
new_doc.insert()
File “apps/frappe/frappe/model/document.py”, line 310, in insert
self.run_post_save_methods()
File “apps/frappe/frappe/model/document.py”, line 1122, in run_post_save_methods
self.run_method(“on_update”)
File “apps/frappe/frappe/model/document.py”, line 954, in run_method
out = Document.hook(fn)(self, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1320, in composer
return composed(self, method, *args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 1302, in runner
add_to_return_value(self, fn(self, *args, **kwargs))
^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/model/document.py”, line 951, in fn
return method_object(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/core/doctype/user/user.py”, line 205, in on_update
self.send_password_notification(self.__new_password)
File “apps/frappe/frappe/core/doctype/user/user.py”, line 358, in send_password_notification
self.send_welcome_mail_to_user()
File “apps/frappe/frappe/core/doctype/user/user.py”, line 442, in send_welcome_mail_to_user
self.send_login_mail(
File “apps/frappe/frappe/core/doctype/user/user.py”, line 482, in send_login_mail
frappe.sendmail(
File “apps/frappe/frappe/init.py”, line 766, in sendmail
return builder.process(send_now=now)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 700, in process
queue_data = self.as_dict(include_recipients=False)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 745, in as_dict
mail = self.prepare_email_content()
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 669, in prepare_email_content
sender=self.sender,
^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_queue/email_queue.py”, line 567, in sender
return email_account.default_sender
^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “apps/frappe/frappe/email/doctype/email_account/email_account.py”, line 328, in default_sender
return email.utils.formataddr((self.name, self.get(“email_id”)))
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File “/usr/lib/python3.11/email/utils.py”, line 91, in formataddr
address.encode(‘ascii’)
^^^^^^^^^^^^^^
AttributeError: ‘NoneType’ object has no attribute ‘encode’

Thank you!

Hi @Alfiya_Hussain,

Please check the video.

If Send Welcome Email is enabled then please 1 to 0 is set in import time.

I hope this helps.

Thank You!

1 Like

@NCP I’m sorry. I didn’t understand the step. Can you make it clear?

Okay @Alfiya_Hussain,

When you import then please set 0 in Send Welcome Email.

Please check it.

Thank You!

1 Like

@NCP , but this must be done only if i have enabled the send welcome mail option. right?
But I haven’t enabled it.
Thankyou!

@Alfiya_Hussain,

If you set up an email account, you won’t face any issues during import. However, if you haven’t set up an email account, you will encounter an error during the import process. Please watch my video again for more details.

Thank You!

@NCP Thank you! It worked