TypeError when create new site using --db-type postgres

Here is what I’ve done on a fresh WSL Ubuntu 18.04 Windows 10 1903:

sudo apt update
sudo apt install python3-dev
sudo apt install python3-setuptools python3-pip
sudo apt install redis-server
curl -sL https://deb.nodesource.com/setup_8.x | sudo -E bash -
sudo apt install nodejs
sudo npm install -g yarn
sudo chown -R lap .config/
git clone https://github.com/frappe/bench
pip3 install --user -e bench
bench init --frappe-branch develop frappe-bench
cd frappe-bench
bench new-site vgs --db-type postgres

Then I provide postgres super user and password:

Enter postgres super user: postgres
Postgres super user password: postgres

And I get this TypeError:

Traceback (most recent call last):
File "/usr/lib/python2.7/runpy.py", line 174, in _run_module_as_main "__main__", fname, loader, pkg_name)
File "/usr/lib/python2.7/runpy.py", line 72, in _run_code exec code in run_globals
File "/home/lap/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 97, in <module> main()
File "/home/lap/frappe-bench/apps/frappe/frappe/utils/bench_helper.py", line 18, in main click.Group(commands=commands)(prog_name='bench')
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 764, in __call__ return self.main(*args, **kwargs)
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 717, in main rv = self.invoke(ctx)
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 1137, in invoke return _process_result(sub_ctx.command.invoke(sub_ctx))
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 956, in invoke return ctx.invoke(self.callback, **ctx.params)
File "/home/lap/frappe-bench/env/local/lib/python2.7/site-packages/click/core.py", line 555, in invoke return callback(*args, **kwargs)
File "/home/lap/frappe-bench/apps/frappe/frappe/commands/site.py", line 33, in new_site db_type = db_type)
File "/home/lap/frappe-bench/apps/frappe/frappe/commands/site.py", line 66, in _new_site source_sql=source_sql,force=force, reinstall=reinstall, db_type=db_type)
File "/home/lap/frappe-bench/apps/frappe/frappe/installer.py", line 35, in install_db setup_database(force, source_sql, verbose)
File "/home/lap/frappe-bench/apps/frappe/frappe/database/__init__.py", line 13, in setup_database return frappe.database.postgres.setup_db.setup_database(force, source_sql, verbose)
File "/home/lap/frappe-bench/apps/frappe/frappe/database/postgres/setup_db.py", line 5, in setup_database root_conn = get_root_connection()
File "/home/lap/frappe-bench/apps/frappe/frappe/database/postgres/setup_db.py", line 50, in get_root_connection frappe.local.flags.root_connection = frappe.database.get_db(user=root_login, password=root_password)
File "/home/lap/frappe-bench/apps/frappe/frappe/database/__init__.py", line 29, in get_db import frappe.database.postgres.database
File "/home/lap/frappe-bench/apps/frappe/frappe/database/postgres/database.py", line 18, in <module> lambda value, curs: float(value) if value is not None else None)
TypeError: argument 2 must be str, not unicode

My PostgreSQL server is running on localhost:5432.
Please help me. Thank you.

Hi @lapphan ,
are you able to solve this issue…

I think this is the answer:

ok, but what happen with wsl and mariadb is it working.

Yes, it is working perfectly.

Thx @lapphan
I did reset to start again, still I am stuck, do you recommend postgres or mariadb.
Could share steps please

Thx a lot

I wanted to use postgres but ERPNext is not supported postgres yet so mariadb is the only option.
Just follow the detail guide here: The Hitchhiker's Guide to Installing Frappe on Linux · frappe/frappe Wiki · GitHub
You should also check this: Mysql ErrorNo 22 on Site installation

1 Like