[PATCH] contrib/importers/keepass2csv2pass.py: remove deprecated 'U' open mode

Erich Ericson fakefakefans at gmail.com
Sun Apr 16 18:18:57 UTC 2023


Hi password-store@,
while importing keepass2 csv exports into pass on a recent Fedora
Workstation release using Python 3.11,
I noticed that the script crashed due to the open mode string being unparseable.
Turns out Universal newline mode is already the default since python
3.0 and that option has been long deprecated and
removed in Python 3.11 in favor of the 'newline' kwarg.
So remove the invalid open mode char as Python 3.0 is already the
requirement for running this script.

Cheers,
DaErich

>From 9283c28383af16189bea93a1b4de413ffe6b243e Mon Sep 17 00:00:00 2001
From: Erich Ericson <fakefakefans at gmail.com>
Date: Sun, 16 Apr 2023 18:38:45 +0200
Subject: [PATCH] contrib/importers/keepass2csv2pass.py: remove
 deprecated 'U' open mode

It is deprecated since at least python 3.10 and has been removed in
python 3.11 causing this script to fail on rolling release distros

Signed-off-by: Erich Ericson <fakefakefans at gmail.com>
---
 contrib/importers/keepass2csv2pass.py | 2 +-
 1 file changed, 1 insertion(+), 1 deletion(-)

diff --git a/contrib/importers/keepass2csv2pass.py
b/contrib/importers/keepass2csv2pass.py
index c3bd288..b61fc04 100755
--- a/contrib/importers/keepass2csv2pass.py
+++ b/contrib/importers/keepass2csv2pass.py
@@ -83,7 +83,7 @@ def insert_file_contents(filename, preparation_args):

     entries = []

-    with open(filename, 'rU') as csv_in:
+    with open(filename, 'r') as csv_in:
         next(csv_in)
         csv_out = (line for line in csv.reader(csv_in, dialect='excel'))
         for row in csv_out:
-- 
2.39.2


More information about the Password-Store mailing list