Although this works, I am thinking it would be better to parse the answer through python calls versus dealing with a extra file.  For instance, you could do something like.  

```
find_pgcount = 'psql -d vmdb_production -U root -c "SELECT count(*) from pg_stat_activity" -L pgcount'
psql_output = run_command(find_pgcount)
count = psql_out.split("\n")[2].strip()
```