jmespath / jmespath/jmespath.py

Facing issue while using jmespath in docker

Open
#320 1 comment 0 reactions 0 assignees View on GitHub
Dominant language
Python
Stars
2.4k
Forks
212
PR merge metrics
No merged PRs in 30d

Description

So this is my file:

```
import jmespath
a = {
"z": 2,
"x": 3,
"c": 4
}

e1 = "z + x"
e2 = "x * c"

print(jmespath.search(e1, a))
print(jmespath.search(e2, a))
```

Also this is my docker file:
```
FROM python:3.9-alpine

RUN pip install jmespath jmespath-community

COPY my-test.py .

CMD ["python", "my-test.py"]
```

The same code works when I just run the python file. But when run through docker, this throws these kind of errors:

```Traceback (most recent call last):
File "//my-test.py", line 12, in
print(jmespath.search(e1, a))
File "/usr/local/lib/python3.9/site-packages/jmespath/__init__.py", line 12, in search
return parser.Parser().parse(expression).search(data, options=options)
File "/usr/local/lib/python3.9/site-packages/jmespath/parser.py", line 88, in parse
parsed_result = self._do_parse(expression)
File "/usr/local/lib/python3.9/site-packages/jmespath/parser.py", line 96, in _do_parse
return self._parse(expression)
File "/usr/local/lib/python3.9/site-packages/jmespath/parser.py", line 109, in _parse
self._tokens = list(self.tokenizer)
File "/usr/local/lib/python3.9/site-packages/jmespath/lexer.py", line 107, in tokenize
raise LexerError(lexer_position=self._position,
jmespath.exceptions.LexerError: Bad jmespath expression: Unknown token +:
z + x
```

Is there something we are doing wrong? because the same code works on local, but not when deployed to a server through docker.

Contributor guide

No contributing guide indexed for this repository

Assessment

This issue has not been assessed yet.

Get new issues in your inbox

A short digest of beginner-friendly GitHub issues.