Skip to content

Else statement needed..and USERNAME dependency. #57

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!

Activity

  1. jwp commented on Dec 8, 2011

    @jwp
    Contributor

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

  2. jwp commented on Dec 8, 2011

    @jwp
    Contributor

    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

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