pg_slythe

James William Pye pgsql at jwp.name
Fri May 12 01:59:24 UTC 2006


On Thu, May 11, 2006 at 12:30:35PM -0700, Adrian Klaver wrote:
> Failure:
> aklaver at tucker:~> export -n PGUSER='aklaver'
> aklaver at tucker:~> pg_python -d business_app  -h localhost -U postgres
> Traceback (most recent call last):
>   File "/usr/local/bin/pg_python", line 254, in ?
>     main(sys.argv)
>   File "/usr/local/bin/pg_python", line 143, in main
>     from postgresql.utility.client import option
>   File 
> "/usr/local/lib/python2.4/site-packages/postgresql/utility/client/option.py", 
> line 34, in ?
>     default = os.environ.get('PGUSER') or os.getlogin() or None,
> OSError: [Errno 2] No such file or directory

Does python -c 'from os import getlogin; print getlogin()' show your username?

In any case, I think I'm going to change that default. If you sudo to another
user, os.getlogin() will return the user name that you logged in as, which I
don't think is actually desirable.


More information about the Python-general mailing list