'how to create logic to run python code in self made code editor properly like python shell

I have create run function to run python script but when i use input() code it shows error error is


Enter any numberTraceback (most recent call last):

  File "C:\Users\USER\Downloads\N1.py", line 1, in <module>

    a = int(input("Enter any number"))

EOFError: EOF when reading a line


            command = f"python {self.file}"
            run_file = subprocess.Popen(command, stdin=subprocess.PIPE,stdout=subprocess.PIPE, stderr=subprocess.PIPE, shell=True)
            Output, error = run_file.communicate()
            self.text.output_area.insert(END,f"{self.file}>>\n")
            self.text.output_area.insert(END,Output)
            self.text.output_area.insert(END,error) 

what modification I have to do in my run function ?????



Sources

This article follows the attribution requirements of Stack Overflow and is licensed under CC BY-SA 3.0.

Source: Stack Overflow

Solution Source