Skip to content

pyzowe wrapper suggestion #64

@zFernand0

Description

@zFernand0

Discussed in #56

Originally posted by salasac September 26, 2025
Link to script; https://github.com/zowe/zowe-cli-sample-scripts/blob/main/python/pyzowe/pyzowe.py

I have a minor suggestion for the pyzowe module that sets up the terminal environment

When executing the subprocess.run() method, I've added the following parameter: " env=os.environ | {"FORCE_COLOR": "0"} ".
Note, since it uses the os.environ method, it'll be necessary to import os.

Why? Well, for a little bit of context, for my purposes I'm using the "zowe zos-files search" command to search datasets for a given string. When you run this in a terminal (and perhaps for other commands too), the results are nicely formatted and uses ANSI colors to highlight useful info.

Unfortunately, these ANSI color codes will now be in the results of your "commandResponse" and inadvertently breaks the JSON formatting. So, by adding the environment variable "FORCE_COLOR:0", you effectively disable the ability to use these ANSI color codes, and they won't exist in your output.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions