From 34406230023c3c3715264a7de180a576fd7def48 Mon Sep 17 00:00:00 2001 From: Lorenzo <79980269+bastonero@users.noreply.github.com> Date: Wed, 27 Mar 2024 12:14:21 +0100 Subject: [PATCH] CLI: Fix import of `StructureData` from QE input file (#1018) The click option already returns a file handle, so the command itself should not try to open it again, which excepts. --- src/aiida_quantumespresso/cli/data/structure.py | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/src/aiida_quantumespresso/cli/data/structure.py b/src/aiida_quantumespresso/cli/data/structure.py index d5c414550..e8325a7ea 100644 --- a/src/aiida_quantumespresso/cli/data/structure.py +++ b/src/aiida_quantumespresso/cli/data/structure.py @@ -20,8 +20,7 @@ def cmd_import(filename, dry_run): """Import a `StructureData` from a Quantum ESPRESSO input file.""" from aiida_quantumespresso.tools.pwinputparser import PwInputFile - with open(filename, 'r', encoding='utf-8') as input_file: - parser = PwInputFile(input_file.read()) + parser = PwInputFile(filename.read()) structure = parser.get_structuredata() formula = structure.get_formula()