I tried to execute a python program via terminal, and it restarted my MacBook.
And I tried to find out what the cause was, so I executed Python programs, and this is the result;
It restarts only when the program involves turtle module in Python
It only restarts when I execute it in terminal via the Python ().py command,
It doesn't restart when executed in IDLE
It sometimes makes the screen smaller (which I can't reproduce any more, and seemed very random) (Ask me if you want more detail)
I'm on macOS v10.15.3 (Catalina)
I'm using Sublime Text as the text editor
pip --version → pip 20.0.2
Also this popped up once:
2020-03-16 22:32:47.640 python[32453:105648] CGSTrackingRegionSetIsEnabled returned CG error 268435459
(I searched in the Internet, but I only found Tkinter cases, so I think this bug is related with window opening in Python?)
It restarts every single time when I execute the turtle program in Python. How do I fix this bug?
Turtle uses graphics. Maybe due to low graphic resolution, your machine is crashing.
Change your performance from low -to- high.
Change the power option from saving to performance.
Clear the background processes
Last, but not least, check your machine cooling, may this works.
Related
I am learning Python (v 3.7) on a Mac using PyCharm. As I practice using the turtle library, the program runs without error, outputs the correct graphics, but then the graphics screen disappears immediately after the code completes runnning. Adding time.sleep(5) at the end of my program persists it and also shows that the focus changed from PyCharm to a Python program menu (which I can't find or turn on in the hope of keeping running).
When I use Thonny, the output persists, so I can check my work. How can I make it persist in PyCharm?
A well-structured Python turtle program will end with a call to mainloop() or one of its variants (exitonclick(), done()) This turns control over to the underlying tkinter event handler which will keep your window open, awaiting user events. Without this, the program simply ends and the window closes.
You don't need time.sleep() nor input("Press Enter to continue..."). Some Python programming environments clash with mainloop() but even those tend to disable it behind the scenes so the same code works everywhere.
First, do not use PyCharm to test. If you like it, more power to you, but personally, I have had many issues with output and PyCharm. Learn the command line, since you are using Mac. CodeAcacdemy and LinuxJournery have really good resources on that subject. Second, if you are still having issues, please reinstall trutle, Python 3.7 (there were some issues wiht it displaying on Mac), and macOS itself. Have a great day!
https://linuxjourney.com/
https://www.codecademy.com/learn/learn-the-command-line
Problems getting pygame to show anything but a blank screen on Macos Mojave
I run a complex python program that is computationally demanding.
While it is complex in terms of number of lines of code, the code itself is simple: it is not multi-thread, not multi-process and does not use any "external" library, with the exception of colorama, installed via pip.
The program does not require a big amount of memory.
When I run it, and monitor via "htop", it shows one (out of the eight) cpu is used 100% by the script, and around 1.16GB (out of 62.8GB) of memory are used (this number remains more or less steady).
After a while (10 to 20 minutes) of running the script, my ubuntu dell desktop running ubuntu 16.04 systematically freezes. I can move the mouse, but clicks do not work, the keyboard is unresponsive, and running programs (e.g. htop) freeze. I can only (hard) reboot. Note that the last frame displayed by htop does not show anything unexpected (e.g. no higher usage of memory).
I never experience such freezes when not running the python program.
I do nothing special in parallel of running the script, aside of browsing with firefox or dealing with mails using thunderbird (i.e. nothing that would use cpu or ram in a significative fashion).
I have printed traces in my python code: it never crashes at the same state.
I also print kernel logs in another terminal: nothing special is printed at the time of the freeze.
I do not use any IDE, and run the script directly from a terminal.
Searching for similar issue, it seems that they are usually related to overusage of memory, which does not seem to be my case.
I have no idea how to investigate this issue.
I spend a lot of time running programs from python using the subprocess module. One of my scripts uses the check_call command to run a program from the command line around 600 times. Today I updated to Spyder 3 and when I run this script I get a pop up which looks like this
This stays for the duration of the program (a few seconds) then disappears but then another appears to replace it as my programs uses the check_call command again. This behavior is very disruptive as it means I can't just run a long program in the background on my machine whilst working on something else. Also this was never a problem on the old version of Spyder I had. Does anybody know how to turn this very annoying behavior off?
(Spyder dev here) If I'm not mistaken, now you need to pass the parameter shell=True to all subprocess commands you're using to avoid this problem.
I just started trying out PyCharm, and while it is very nice, I found the interactive console in debugger (that can be activated with "Show Python Prompt" on a breakpoint) is unusably slow. If I keep pressing enter, for example, after 2-3 tries, I have to wait several seconds for the next prompt to show up.
Is this a common experience? I'm running Pycharm with a pretty fast machine (with i7-3770 CPU) so I was wondering if something is wrong.
I too have experienced the same problem quite a few times but With every new version released new problem too pop out . Its not the first time PyCharm is giving some one a hard time. In previous version the IDE would just stop working or not debug at all .
The best way to solve this is by writing to Jet Brains so they can find and solve the issue and release a new update.
Greetings dear community,
I am currently using Sublime Text 2 (Unregistered) as my coding agent. And there is a strange behavior i noticed lately. When i am running a code in sublime text(Through build, with CTRL-B), if a code needs long time to run, like an infinite loop, I try to cancel the build(I specified CTRL-SHIFT-B to cancel build), sublime text shows me a message that build is cancelled
[Cancelled]
like so. In regular command line this means python program is no longer running. As I think it should be the same in sublime text, however, it is not. As longer i keep trying to cancel than build again, more and more python.exe keeps showing in the task manager. I can have like 10 python.exe running behind if I don't end process manually through task manager. Can somebody explain this behavior to me please ? And the reason behind it, can I prevent it ?
By the way, I tested the Python IDLE, and command prompt before asking so i could provide more information
Python IDLE shows same behavior and keeps python exe's running after cancelling.
Command prompt stops the process with no problem.
I am using python2 in a windows 8.1 system.
Thanks in advance for your time.