`--json` output is not valid JSON for `search --export`, `image upload <dir>`, `model upload` and `version download`
Los mantenedores suelen responder en 1 día
Evaluación
- Dificultad
- 3/5
- Tiempo estimado
- 1-2 días
- Aptitud para principiantes
- 20/100
Línea de trabajo
Start with search.py::_do_export, image.py::_handle_upload_directory, model.py::_upload_model, and version.py::_download, then read CLI-COMMANDS.md and CLAUDE.md for the JSON-output contract and SDK-output guidance. The issue says the reporter is sending a PR right away, so check for that work before starting; done means each command's stdout parses with json.loads while progress and failure messages remain visible.
Escrito por el modelo de indexación a partir del texto del issue.
Descripción
CLI-COMMANDS.md describes --json as "Structured JSON output (for agents and piping)", and CLAUDE.md asks handlers to wrap SDK calls in suppress_sdk_output(). Four handlers call SDK methods that print to stdout outside such a block, so stdout is a mix of plain-text status lines and the pretty-printed JSON result, and json.loads(stdout) or | jq fails (roboflow 1.7.0 and current main; --quiet does not change it):
| Command | Handler → SDK call | Printed to stdout before the JSON |
|---|---|---|
search --export |
search.py::_do_export → Workspace.search_export() |
"Export started (id=...)...", "If this takes too long, ...", "Search export extracted to ..." |
image upload <dir> |
image.py::_handle_upload_directory → Workspace.upload_dataset() |
"Uploading to existing project ...", one [UPLOADED]/[DUPLICATE]/[ERR] line per image |
model upload |
model.py::_upload_model → Roboflow.workspace(), Workspace.project(), Version.deploy() / Workspace.deploy_model() |
"loading Roboflow workspace...", "loading Roboflow project..." (this handler does not use suppress_sdk_output() at all), "View the status of your deployment at: ...", "Share your model with the world at: ..." (or the error) |
version download |
version.py::_download → Version.download() |
when the format is generated on demand: "\rExporting format coco in progress : 40.0%", "\rVersion export complete for coco format" |
Example (offline: HTTP mocked with responses, command run with typer.testing.CliRunner):
$ roboflow --json search "project:my-project" --export -l out
Export started (id=exp1). Polling for completion...
If this takes too long, you can check the export status at: https://api.roboflow.com/my-workspace/search/export/exp1?api_key=YOUR_API_KEY
Search export extracted to /.../out
{
"status": "completed",
"path": "/.../out"
}
Proposal: in JSON mode, run these SDK calls inside contextlib.redirect_stdout(sys.stderr), so progress stays visible and stdout stays JSON, with one test per handler that parses stdout with json.loads. Simply suppressing the output with suppress_sdk_output() would hide the per-image [ERR] lines of image upload, which are currently its only failure signal (#545). A more general alternative: in JSON mode, redirect sys.stdout to stderr for the whole command and let output() write to the original stdout, which would also cover future handlers.
I'm sending a PR for the per-handler variant right away.
cc @yeldarby
- Lenguaje dominante
- Python
- Estrellas
- 633
- Forks
- 141
- Merge medio
- 1 d 19 h
- PR fusionados (30 d)
- 14
Preparar el entorno
Inicia el contenedor de desarrollo del proyecto en tu navegador, con tu propia cuenta de GitHub.
- Sin Dockerfile ni archivo de Docker Compose
- Sin plantilla de pull request
- Leer la guía de contribución
Primeros pasos
- Lee el issue completo y luego la guía de contribución del proyecto.
- Comenta en el issue que vas a ocuparte — evita que dos personas hagan lo mismo.
- Haz un fork del repositorio y trabaja en una rama.
- Abre un pull request que haga referencia al número del issue.
Más de roboflow/roboflow-python
-
Dificultad 4/5 3-5 días Aptitud para principiantes 55/100
roboflow/roboflow-python#545 ·
Los mantenedores suelen responder en 1 día
-
RLE segmentation mask visible in dataset thumbnail, but invisible in annotation preview/editorAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 45/100
roboflow/roboflow-python#505 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
Dificultad 4/5 3-5 días Aptitud para principiantes 30/100
roboflow/roboflow-python#433 ·
Los mantenedores suelen responder en 1 día
-
Dataset Download StuckAbierto
Dificultad 4/5 3-5 días Aptitud para principiantes 25/100
roboflow/roboflow-python#429 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 3/5 1-2 días Aptitud para principiantes 35/100
roboflow/roboflow-python#427 · 1 comentario ·
Los mantenedores suelen responder en 1 día
Todos los issues de roboflow/roboflow-python
Issues similares
-
area: desktop area: website priority: P2 type: feature
Dificultad 2/5 1-3 horas Aptitud para principiantes 62/100
appandflow/stim#3411 · 1 comentario ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 Menos de una hora Aptitud para principiantes 88/100
baptistehamon/lsapy#185 ·
Los mantenedores suelen responder en 1 día
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 82/100
PolicyEngine/policyengine-us#10073 ·
Los mantenedores suelen responder en 2 días
-
Dificultad 2/5 1-3 horas Aptitud para principiantes 72/100
syedhamidali/radarx#277 ·
Los mantenedores suelen responder en 1 día
-
bug
Dificultad 2/5 1-3 horas Aptitud para principiantes 68/100
Arekkazu/sgpmp-backend#549 ·
Los mantenedores suelen responder en 1 día