-
Notifications
You must be signed in to change notification settings - Fork 187
Open
Description
Piping to stdin sometimes does not work. Let's take the httpbin.org example:
> cat helloip.tmpl
Your IP address is {{ origin }}.
> curl -s http://httpbin.org/ip | jinja2 helloip.tmpl
Your IP address is .
Yet, the curl command does output JSON:
> curl -s http://httpbin.org/ip
{
"origin": "xx.xx.xx.127"
}
In fact saving this to a file and then using cat to pipe it to jinja2 does work:
> curl -s http://httpbin.org/ip > httpbin.json
> cat httpbin.json | jinja2 helloip.tmpl
Your IP address is xx.xx.xx.127.
Not sure why piping cat would be any different than piping curl.
I'm on macOS Ventura 13.3.1 (Intel) running Python installed from Homebrew and jinja2-cli installed into a venv.
> jinja2 --version
jinja2-cli v0.8.2
- Jinja2 v3.1.2
> python --version
Python 3.11.3
> pip list
Package Version
---------- -------
Jinja2 3.1.2
jinja2-cli 0.8.2
MarkupSafe 2.1.2
pip 23.0.1
setuptools 67.6.1
(Edited to remove my real IP address.)
Metadata
Metadata
Assignees
Labels
No labels