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
-
Build PyThaiNLP Docker image:
git clone https://github.com/PyThaiNLP/pythainlp.git
cd pythainlp
# Apply WORKDIR fix to Dockerfile first
docker build -t pythainlp .
-
Run any CLI command:
docker run --rm pythainlp thainlp tokenize word "สวัสดีครับ"
docker run --rm pythainlp thainlp data catalog
docker run --rm pythainlp thainlp soundex "วรรณ"
-
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
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
Current results
$ docker run --rm pythainlp thainlp tokenize word "สวัสดีครับ" $(No output is produced)
Steps to reproduce
Build PyThaiNLP Docker image:
Run any CLI command:
Observe that no output is produced
More info
docker run --rm pythainlp python -c "from pythainlp.tokenize import word_tokenize; print(word_tokenize('สวัสดีครับ'))"outputs['สวัสดี', 'ครับ']localeandsys.stdout.encoding)-t(TTY) and without TTY allocationPYTHONUNBUFFERED=1environment variable - no effectEnvironment: