Postgresql While Loop Exit Python Venv Create