Closed GadgetSteve closed 1 month ago
The problem results from the use of singe % characters in the Windows epilogue set from line 64 in _internal/environment.py which is then processed with % formatting by argparse. The following patch will resolve:
diff --git a/cyclonedx_py/_internal/environment.py b/cyclonedx_py/_internal/environment.py
index abc13b0..b676db2 100644
--- a/cyclonedx_py/_internal/environment.py
+++ b/cyclonedx_py/_internal/environment.py
@@ -64,23 +64,23 @@ class EnvironmentBB(BomBuilder):
> %(prog)s "...\\some\\path\\bin\\python.exe"
> %(prog)s "...\\some\\path\\.venv"
> %(prog)s "$env:VIRTUAL_ENV"
- > %(prog)s %VIRTUAL_ENV%
+ > %(prog)s %%VIRTUAL_ENV%%
• Build an SBOM from specific Python environment:
> where.exe python3.9.exe
- > %(prog)s "%path-to-specific-python%"
+ > %(prog)s "%%path-to-specific-python%%"
• Build an SBOM from conda Python environment:
> conda.exe run where.exe python
- > %(prog)s "%path-to-conda-python%"
+ > %(prog)s "%%path-to-conda-python%%"
• Build an SBOM from Pipenv environment:
> pipenv.exe --py
> pipenv.exe --venv
- > %(prog)s "%path-to-pipenv-python%"
+ > %(prog)s "%%path-to-pipenv-python%%"
• Build an SBOM from Poetry environment:
> poetry.exe env info --executable
- > %(prog)s "%path-to-poetry-python%"
+ > %(prog)s "%%path-to-poetry-python%%"
• Build an SBOM from PDM environment:
> pdm.exe info --python
- > %(prog)s "%path-to-pdm-python%"
+ > %(prog)s "%%path-to-pdm-python%%"
""")
else: # if os_name == 'posix':
p.epilog = dedent("""\
confirmed via https://github.com/CycloneDX/cyclonedx-python/pull/807
thank you for the report and fix
fix published via version 4.6.1
Describe the bug
On Windows running
cyclonedx-py environment -h
results in a crash that outputs:To Reproduce
On a Windows machine run
cyclonedx-py environment -h
Expected behavior
Expected to see the help text.
Screenshots or output-paste
cyclonedx-py environment -h
Environment
v3.2.0
. get viacyclonedx-py --version
-->Additional context
Problem also occurs with other versions of python including 3.13.0rc2.