Skip to content

Else statement needed..and USERNAME dependency. #57

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
ghost opened this issue Dec 7, 2011 · 2 comments
Open

Else statement needed..and USERNAME dependency. #57

ghost opened this issue Dec 7, 2011 · 2 comments

Comments

@ghost
Copy link

ghost commented Dec 7, 2011

Hi!

There is a use case not being handled here, causing it to fail on my WinXP machine(variable isn't initialised).
It is at line 142 at clientparameters.py:

if sys.platform == 'win32':
    appdata = environ.get('APPDATA')
    if appdata:
        pgdata = os.path.join(appdata, pg_appdata_directory)
        pgpassfile = os.path.join(pgdata, pg_appdata_passfile)
else:

Adding an else statement on appdata like at least makes the error go away and the test succeed on my install:

    if appdata:
        pgdata = os.path.join(appdata, pg_appdata_directory)
        pgpassfile = os.path.join(pgdata, pg_appdata_passfile)
    else:
        pgpassfile = ''

Also, the USERNAME environment variable seem to be necessary on windows but not on linux.
I don't see why "user" doesn't seem to be passed from postgresql.driver.dbapi20.connect?
I makes it far less portable.

Otherwise, great work!

@jwp
Copy link
Contributor

jwp commented Dec 8, 2011

Oh, thanks. I'll look into getting your suggestions implemented soon.

@jwp
Copy link
Contributor

jwp commented Dec 8, 2011

user should be passed from dbapi20.connect... I'll look into it.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant