Skip to content

Else statement needed..and USERNAME dependency. #57

Open
@ghost

Description

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!

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions