Skip to content

Commit f0d0426

Browse files
committed
Fix #91: pgpassfile is not defined at w32 because APPDATA is not defined
1 parent e8f5059 commit f0d0426

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

postgresql/clientparameters.py

+3-1
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ def defaults(environ = os.environ):
147147
if appdata:
148148
pgdata = os.path.join(appdata, pg_appdata_directory)
149149
pgpassfile = os.path.join(pgdata, pg_appdata_passfile)
150+
else:
151+
pgpassfile = None
150152
else:
151153
pgpassfile = os.path.join(userdir, pg_home_passfile)
152154

@@ -157,7 +159,7 @@ def defaults(environ = os.environ):
157159
('sslrootcrlfile', os.path.join(pgdata, 'root.crl')),
158160
('pgpassfile', pgpassfile),
159161
):
160-
if os.path.exists(v):
162+
if v and os.path.exists(v):
161163
yield (k,), v
162164

163165
def envvars(environ = os.environ, modifier = 'PG'.__add__):

0 commit comments

Comments
 (0)