1

I recently started using Python. I realized that even the simplest program starts a Python process that never ends and causes my computer to overheat if I don't manually kill that process.

I've even seen multiple Python processes running at the same time after running a few easy Python programs (Hello, World!) in a row.

I updated to the latest Python version (Python 3.9.3), installed all the Certificates, and tested a few different programs to see if it happens every time—it does. I am using VSC as the IDE but the same situation happens even if I use IDLE.

My questions are: Is this an interpreter issue or a Mac issue? Can it be fixed?

Thank you very much.

enter image description here

enter image description here

Valy
  • 406
  • 3
  • 13
  • 2
    Could you post a sample python code you're running? Is it the one in the screen shot? It might be running a wrong script since I see there are multiple py scripts in the screenshot. IDLE should have Python process running since it's actively waiting for Python code input. Have you tried running the script on the terminal using the command `python `? – tax evader Apr 04 '21 at 00:10
  • Thank you, that worked. I ran the script as shown in the photo, but I was using the 'Run Python File in Terminal' button to run it (in VSC). Then I'd write a 'Hello World' script in the same file. The scripts were executing and I was getting the correct output in all cases. However, there must have been an issue with the location of the file--as soon as I navigated to the folder containing the Python file and ran it from there, no more hanging processes. I'll look at my "cwd" settings, maybe there is some conflict somewhere. – Valy Apr 04 '21 at 00:45
  • Well, nevermind... now, as soon as I close VSC, a Python process starts on its own using CPU resources similar to the ones shown in my first photo. No other IDEs or scripts running. If repoen VSC and run another script (using `python `), then quit VSC, an additional process starts. Again, running only a basic script, as shown in the photo. – Valy Apr 04 '21 at 01:02
  • Yes, it's '(null) (2083)'. I'll try reinstalling VSC shortly, but since it was doing the same thing while using IDLE too, it may not do much. – Valy Apr 04 '21 at 01:48
  • Yes, the %CPU numbers and graph are always similar to what is shown in the picture. The CPU fan kicks on within a minute or two too. FYI, this is a new issue that started recently, exactly after I installed the Python extension in VSC. But yeah, I'll try removing/reinstalling VSC, Python, and restore the OS to an earlier back up and see what that does... – Valy Apr 04 '21 at 02:12
  • Could you open the terminal and enter command `ps ax | grep 2083`, you can replace 2083 with any number that is the ID of the parent process of the Python process you mentioned? What does it output? – tax evader Apr 04 '21 at 02:30
  • Other people seem to be having the same issue, due to VSC... https://stackoverflow.com/questions/66518708/runaway-jedi-language-task-in-vscode – Valy Apr 04 '21 at 03:08
  • 2
    I think this is an open issue in VSC. Does [these steps](https://github.com/microsoft/vscode-python/issues/15586#issuecomment-792360066) resolve your issue? – tax evader Apr 04 '21 at 03:08
  • Oh so is it fixed now? – tax evader Apr 04 '21 at 03:15
  • 1
    YES, it's fixed! The info on github is gold. I hope they fix the issue for the future. Thank you very much for all the help! – Valy Apr 04 '21 at 03:24

0 Answers0