1

Topic: import_users.py not working

==== REQUIRED BASIC INFO OF YOUR IREDMAIL SERVER ====
- iRedMail version (check /etc/iredmail-release): 1.3.2 MARIADB edition.
- Deployed with iRedMail Easy or the downloadable installer?: downloadable installer
- Linux/BSD distribution name and version: Debian 10.13
- Store mail accounts in which backend (LDAP/MySQL/PGSQL): MySQL
- Web server (Apache or Nginx): Nginx
- Manage mail accounts with iRedAdmin-Pro? YES
- [IMPORTANT] Related original log or error message is required if you're experiencing an issue.
====
RESTful API is enabled, api_endpoint is configured ok, username and password is correct.

When I'm trying to add users from /opt/user.list I'v an error:

root@mail:/opt/www/iredadmin/tools# python3 import_users.py /opt/users.list
Traceback (most recent call last):
  File "import_users.py", line 139, in <module>
    res = r.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

or

root@mail:/opt/www/iredadmin/tools# python import_users.py /opt/users.list 
Traceback (most recent call last):
  File "import_users.py", line 58, in <module>
    import requests
ImportError: No module named requests

There are no new lines in log file when executing import_users.py:
/var/log/mlmmjadmin/mlmmjadmin.log

cat /opt/user.list
willb@my.domain.com, sdf4fsa323FAS@, 1024, Will Bark

Any idea where is a problem?

Kind regards
Piotr

----

Spider Email Archiver: On-Premises, lightweight email archiving software developed by iRedMail team. Supports Amazon S3 compatible storage and custom branding.

2

Re: import_users.py not working

pitterski wrote:

root@mail:/opt/www/iredadmin/tools# python import_users.py /opt/users.list 

Please run it with command "python3", not "python".

3

Re: import_users.py not working

Please read again what I wrote:

root@mail:/opt/www/iredadmin/tools# python3 import_users.py /opt/users.list
Traceback (most recent call last):
  File "import_users.py", line 139, in <module>
    res = r.json()
  File "/usr/lib/python3/dist-packages/requests/models.py", line 897, in json
    return complexjson.loads(self.text, **kwargs)
  File "/usr/lib/python3/dist-packages/simplejson/__init__.py", line 518, in loads
    return _default_decoder.decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 370, in decode
    obj, end = self.raw_decode(s)
  File "/usr/lib/python3/dist-packages/simplejson/decoder.py", line 400, in raw_decode
    return self.scan_once(s, idx=_w(s, idx).end())
simplejson.errors.JSONDecodeError: Expecting value: line 1 column 1 (char 0)

Kind regards
Piotr

4

Re: import_users.py not working

pitterski wrote:

ImportError: No module named requests

Please install Python module "python3-requests" first, then try again.