Install in Python 3. X web.py

Install web.py in Python 3.x
Recently decided to move from Python 2.7 to work on 3.x.
using the database, still chose before more interested in web. Py
but seemed to have all sorts of problems found when installation.

ImporError: No module named ‘utils’
ModuleNotFoundError: No module named ‘db’

I finally decided to give the dev version a try.

pip install web.py==0.40.dev0

It turns out that the dev version of web.py works perfectly on Python 3.x.
I personally tested Python 3.6
The code is as follows:

import pymysql

pymysql.install_as_MySQLdb()
import web

db = web.database(dbn='mysql', host='db_host', port=3306,
                  user='root', pw='password', db='db_name', charset='utf8')

results = db.query('select * from user where id = 1;')

for user in results:
    print(user.name)
    print(user.id_no)

Hopefully this article will help those of you who are looking for web.py available on Python 3.x.

Read More: