Hacktoberfest 2026: le issue che i maintainer hanno segnato per ottobre, aperte e adatte ai principianti. Sfoglia le issue Hacktoberfest

odc-cli crashes with "'staticmethod' object is not callable" on Python 3.8 and 3.9, which it claims to support

Aperta Adatta ai principianti
#1,776 0 commenti 0 reazioni 0 assegnatari Vedi su GitHub

I maintainer di solito rispondono entro 1 giorno

Nessuno ha ancora preso questa issue.

Valutazione

Difficoltà
2/5
Tempo stimato
1-3 ore
Idoneità per principianti
78/100
Tipo di issue
Bug
Chiarezza
Specificata chiaramente
Stato di attività
Attiva
Stack tecnologico
python
Ambito
cli

Direzione di ricerca

Inizia da cli/odc-cli:58-68 e dai decoratori dei gestori intorno a cli/odc-cli:300-302; cli/AGENTS.md indica la versione di Python supportata e l’assenza di un harness di test. Controlla come vengono applicati i decoratori nelle classi dei comandi, quindi verifica setup get-state, auth login e instruments list con Python 3.8, 3.9 e una versione attuale. Il lavoro è completato quando questi comandi non generano più il TypeError segnalato negli interpreti supportati.

Scritto dal modello di indicizzazione a partire dal testo della issue.

Descrizione

Area: Infrastructure Bug Difficulty: Low Good First Issue Priority: Medium

On Python 3.8 and 3.9, odc-cli crashes with TypeError: 'staticmethod' object is not callable on every command that talks to the API. Each command handler is declared as @require_url (and often @require_token) stacked on @staticmethod. The decorators are applied in order, so require_url receives the staticmethod object itself, and its wrapper later calls fn(*args, **kwargs) on that object. A staticmethod object only became callable in Python 3.10 (bpo-43682). The script states that it targets Python 3.8: cli/AGENTS.md says so, and the file only hard-exits below 3.8. On the interpreters an administrator is most likely to have on a server or laptop, including macOS's /usr/bin/python3 (3.9.6), Debian 11 (3.9) and Ubuntu 20.04 (3.8), nothing works except config and the local auth logout and auth status. That includes auth login, setup, subjects, instrument-records and instruments.

Where

cli/odc-cli:58-68:

def require_url(fn: Callable[..., Any]) -> Callable[..., Any]:
    def wrapper(*args: Any, **kwargs: Any) -> None:
        # ...
        fn(*args, **kwargs)
    return wrapper

cli/odc-cli:300-302 (the same pattern is on every handler in AuthCommands, InstrumentRecordsCommands, SubjectCommands, InstrumentsCommands and SetupCommands):

class AuthCommands:
    @require_url
    @staticmethod
    def login(username: str, password: str) -> None:

Reproduce

  1. With Python 3.9 (for example macOS /usr/bin/python3), run python3 cli/odc-cli config set-url http://127.0.0.1:5500.
  2. Run python3 cli/odc-cli setup get-state.

Actual:

  File "cli/odc-cli", line 68, in wrapper
    fn(*args, **kwargs)
TypeError: 'staticmethod' object is not callable

Expected: the request is sent, as it is on Python 3.10 and later, where the same command prints the setup state or a network-error JSON.

Tests

cli/ has no test harness and nothing in CI runs it (cli/AGENTS.md). Verify the fix by running setup get-state, auth login and instruments list under Python 3.8, 3.9 and the current release, for example with uv run --python 3.8 cli/odc-cli setup get-state.

Suggested fix

Put @staticmethod outermost: write @staticmethod above @require_url and @require_token, so the auth decorators wrap the plain function. Alternatively, keep the order and unwrap inside the decorators with fn = fn.__func__ if isinstance(fn, staticmethod) else fn.

Lingua principale
TypeScript
Stelle
119
Fork
19
Merge medio
1g 2h
PR unite (30g)
56

Preparare l'ambiente

Come iniziare

  1. Leggi tutta la issue e poi la guida ai contributi del progetto.
  2. Commenta sulla issue per dire che te ne occupi tu — evita che due persone facciano lo stesso lavoro.
  3. Fai un fork del repository e lavora su un branch.
  4. Apri una pull request che faccia riferimento al numero della issue.

Altre issue di DouglasNeuroInformatics/OpenDataCapture

Tutte le issue di DouglasNeuroInformatics/OpenDataCapture

Issue simili

Altre issue su TypeScript

Ricevi le nuove issue nella tua casella

Un breve riepilogo di issue GitHub adatte ai principianti.