Skip to content

CLI commands produce no output when run in Docker container #1131

@tassa-yoniso-manasi-karoto

Description

Description

When running PyThaiNLP CLI commands inside a Docker container, no output is produced even though the commands execute without errors.

The Python API works correctly, suggesting the issue is specific to the CLI implementation.

Expected results

$ docker run --rm pythainlp thainlp tokenize word "สวัสดีครับ"
สวัสดี|ครับ|

Current results

$ docker run --rm pythainlp thainlp tokenize word "สวัสดีครับ"
$ 

(No output is produced)

Steps to reproduce

  1. Build PyThaiNLP Docker image:

    git clone https://github.com/PyThaiNLP/pythainlp.git
    cd pythainlp
    # Apply WORKDIR fix to Dockerfile first
    docker build -t pythainlp .
  2. Run any CLI command:

    docker run --rm pythainlp thainlp tokenize word "สวัสดีครับ"
    docker run --rm pythainlp thainlp data catalog
    docker run --rm pythainlp thainlp soundex "วรรณ"
  3. Observe that no output is produced

More info

  • Python API works correctly: docker run --rm pythainlp python -c "from pythainlp.tokenize import word_tokenize; print(word_tokenize('สวัสดีครับ'))" outputs ['สวัสดี', 'ครับ']
  • Environment has proper UTF-8 encoding (verified with locale and sys.stdout.encoding)
  • Issue occurs with both -t (TTY) and without TTY allocation
  • Tested with PYTHONUNBUFFERED=1 environment variable - no effect

Environment:

  • Docker version: 28.3.1
  • PyThaiNLP version: 5.1.0
  • Python version: 3.12 (from python:3.12 base image)
  • Host OS: Linux 6.12

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions