mirror of
https://github.com/eLvErDe/hwraid.git
synced 2025-07-24 22:34:21 +02:00
Old python versions can fall in `ValueError` exception with current string format: ``` $ python Python 2.6.6 (r266:84292, Jun 14 2019, 09:43:27) [GCC 4.4.7 20120313 (Red Hat 4.4.7-23)] on linux2 Type "help", "copyright", "credits" or "license" for more information. >>> import re >>> model = 'Z1Z3XMHGST4000NM0033-9ZM170 GA0A' >>> m = re.match(r'(\w{8})(ST\w+)(?:-(\w{6}))?(?:\s+(\w+))', model) >>> '{}-{} {} {}'.format(m.group(2), m.group(3), m.group(4), m.group(1)) Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: zero length field name in format >>> m.group(2) 'ST4000NM0033' >>> m.group(3) '9ZM170' >>> m.group(4) 'GA0A' >>> m.group(1) 'Z1Z3XMHG' ``` Also corrected spaces to tabs.
HWRaid
Free code from http://hwraid.le-vert.net
Description
Languages
C
54.7%
Shell
16.9%
Python
16.7%
Makefile
9.2%
Roff
2.5%