Where did you get the script from and is it for gimp version 3 or the version your using?
GIMP does not natively support full CMYK color space editing, as it is built around an RGB workflow, though modern versions (GIMP 3.0 and newer) include built-in soft-proofing and CMYK export options.
How to Convert / Export to CMYK in GIMP
Use Soft-Proofing (GIMP 2.10 / 3.0): Go to Edit > Preferences > Color Management to set up a CMYK color profile (such as US Web Uncoated or Coated) for soft-proofing your image on screen.
Export as CMYK (GIMP 3.0 / 2.99+): When exporting your file as a JPEG, TIFF, or PSD, look for and check the Export as CMYK option in the export dialog box. Alternative Plugin (Cyan): Install the free Cyan Plugin (
https://cyan.graphics/) to handle standalone or integrated RGB-to-CMYK conversions and channel separations directly.
Alternative Software (Krita): If you need deep, native CMYK editing, export your file from GIMP as a PSD and open it in Krita, which supports full CMYK color space conversion.
_________________