Mac OSX BigSur PyCharm run program on docker-compose not show any output on console

I follow the official tutorial to set up the docker-compose interpreter, but it not worked.

The output of Solver.py not display on PyCharm's console neither PyCharm service log dialog, it's only display on Docker for Mac dashboard.

 

But when I terminate the process, it will show on service log dialog, but debug console still no any output displayed.

 

And it can't interact with the program too. 

But Docker interpreter worked fine... it's kind of magic, haha.

this is my Dockerfile, docker-compose.yaml, PyCharm settings and my system info

#Dockerfile
FROM python:latest
#docker-compose.yaml
version: '3'

services:
development:
build: .

PyCharm version: 2020.3.3

Python version: 3.9.2

Mac OSX version: 11.2.1

 

How can I let output from docker-compose interpreter can display on PyCharm console, and let me can interact with them?

thanks.

0
5 comments

In most cases you should see the output immediately both in debug console and in the "Log" tab.

Could you give a link to this tutorial so I could try and reproduce the issue?

0

I'm follow this tutorial 
https://www.jetbrains.com/help/pycharm/using-docker-compose-as-a-remote-interpreter.html#summary

But only use the code of this tutorial
https://www.jetbrains.com/help/pycharm/using-docker-as-a-remote-interpreter.html

so my project is very simple, only three files, Solver.py, Dockerfile and docker-compose.yaml.

#Dockerfile
FROM python:latest
#docker-compose.yaml
version: '3'

services:
development:
build: .
#Solver.py
import math

class Solver:

def demo(self, a, b, c):
d = b ** 2 - 4 * a * c
if d > 0:
disc = math.sqrt(d)
root1 = (-b + disc) / (2 * a)
root2 = (-b - disc) / (2 * a)
return root1, root2
elif d == 0:
return -b / (2 * a)
else:
return "This equation has no roots"


if __name__ == '__main__':
solver = Solver()

while True:
a = int(input("a: "))
b = int(input("b: "))
c = int(input("c: "))
result = solver.demo(a, b, c)
print(result)

And the interpreter settings is same as follow

 

0

Update:

I found if I use print, PyCharm console will display text.
But if I use

input("a: ")

It won't display anything.

 

And still can't interact with the program as Docker interpreter.

0

I see, this issue has been discussed in https://youtrack.jetbrains.com/issue/PY-31254

Please see comment from the developer.

1

Please sign in to leave a comment.