Skip to content
Advertisement

python script error message ‘unknown column’ – Redhat

My Python script produces unknown column error on redhat 8.5 python 3.6.8. But works without issue on Ubuntu 20.04 with python 3.8.10

Would this be a python or redhat issue? Is it possible to gather more detailed logs?

Link to full script https://github.com/michael-pellegrini/scripts/blob/master/xtime.py

#!/usr/bin/env python3
import subprocess, re, os

def main():
  storage()

def storage():
  output = str.splitlines(os.fsdecode(subprocess.check_output(['lsblk', '-fm', '-o' 'NAME,' 'FSTYPE,' 'FSAVAIL,' 'FSUSE%,' 'MOUNTPOINT,' 'SIZE,' 'OWNER,' 'GROUP,' 'MODE', '-e 7'])))
  print(esc('1;93') + " List of drives, partitions, and details" + esc(0))
  for line in output:
    print(" " + line)
  print('')

def esc(code):
  return f'33[{code}m'

if __name__=='__main__':
      main()

Redhat error message enter image description here

Ubuntu output enter image description here

Advertisement

Answer

Had to clone this repo https://github.com/util-linux/util-linux.git

Then follow this how-to found here.

https://github.com/util-linux/util-linux/blob/next/Documentation/howto-compilation.txt

lsblk --version
lsblk from util-linux 2.38.141-581b1
User contributions licensed under: CC BY-SA
5 People found this is helpful
Advertisement