From a14f98b1815cd76795af8009d24a927dd10b23cd Mon Sep 17 00:00:00 2001 From: Wolfgang Colsman Date: Tue, 7 May 2024 00:57:24 -0400 Subject: [PATCH 1/2] Fix: AttributeError: 'NoneType' object has no attribute 'attrib' --- pymzml/spec.py | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/pymzml/spec.py b/pymzml/spec.py index db9bc7c..f9d0b4d 100755 --- a/pymzml/spec.py +++ b/pymzml/spec.py @@ -904,8 +904,9 @@ def scan_time(self): scan_time_ele = self.element.find( ".//*[@accession='MS:1000016']".format(ns=self.ns) ) - self._scan_time = float(scan_time_ele.attrib.get("value")) - self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") + if scan_time_ele is not None: + self._scan_time = float(scan_time_ele.attrib.get("value")) + self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") return self._scan_time, self._scan_time_unit # @property From a51022b2c74580badda7cf469304ead0ab546dc5 Mon Sep 17 00:00:00 2001 From: Wolfgang Colsman Date: Tue, 7 May 2024 00:59:25 -0400 Subject: [PATCH 2/2] Fix: AttributeError: 'NoneType' object has no attribute 'attrib' --- pymzml/spec.py | 6 +++--- 1 file changed, 3 insertions(+), 3 deletions(-) diff --git a/pymzml/spec.py b/pymzml/spec.py index f9d0b4d..3001e8f 100755 --- a/pymzml/spec.py +++ b/pymzml/spec.py @@ -904,9 +904,9 @@ def scan_time(self): scan_time_ele = self.element.find( ".//*[@accession='MS:1000016']".format(ns=self.ns) ) - if scan_time_ele is not None: - self._scan_time = float(scan_time_ele.attrib.get("value")) - self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") + if scan_time_ele is not None: + self._scan_time = float(scan_time_ele.attrib.get("value")) + self._scan_time_unit = scan_time_ele.get("unitName", "unicorns") return self._scan_time, self._scan_time_unit # @property