How to fix exit code 127 with a python error

This is the error:
/bin/sh: 1: {python,: not found
I have this code of both C++ and python which are fairly simple and and I just need them to run in the docker.
The C++ code works as it should, yet the python crashes with exit code 127. I’m using docker-compose up --build to build the dockers. any help will be helpful :slight_smile:
Below is the code in the Dockerfile:

FROM python:3

COPY requirements.txt .
RUN python -m pip install -r requirements.txt

WORKDIR /app
COPY . /app
CMD {"python", "main.py"}

The code from requirements.txt:

numpy

The code from main.py:

import numpy as np

arr = np.array([1,2,3])
print(arr)

As I’ve said, fairly simple. Just want to mess with docker a little to try and understand it

Please do not share text output as screenshot! Furthermore, you might want to check the output of python-1 log line.

Before you ask questions like “how do i fix it”, make sure to actually add the content of your Dockerfile and your compose file, so we have an idea of what you actually did.

Thanks for the reply! I’ve edited the post, but please let me know if there’s anything else i should do.

Your updated post still doex exactly that!

I already did. PLease read my last post again.

Then I guess I misunderstood. How should I upload my code for reference?


Please, format your post according to the following guide: How to format your forum posts
In short: please, use </> button to share codes, terminal outputs, error messages or anything that can contain special characters which would be interpreted by the MarkDown filter. Use the preview feature to make sure your text is formatted as you would expect it and check your post after you have sent it so you can still fix it.

Example code block:

```
services:
  service1:
    image: image1
```

After fixing your post, please send a new comment so people are notified about the fixed content.


Yet again, thanks! I’ll do it in a jiffy

I’ve edited the post s.t. all my code is in it. let me know if you need anything else :slight_smile:

This should be:

CMD ["python", "main.py"]

Note: you removed the error message that indicated the problem, so now now noone knows the error was even shown in the first post.

You’re right, I"ll update it one last time.
And once again - thanks! I can’t believe this was the problem haha