问题
I'm totally baffled by this.. Trying to code a python script on my Debian Stretch system but after running a 4 lined script my mouse cursor would turn into a cross and blocking any click actions from working and forcing me to hard reset the system by holding the off button!
I tested a few times and found out that my script just needs to contain an import for it to break, nothing else - literally a one-lined:
import pxssh
And run
./bug.py
System broken. Mouse cursor looks like a cross and cannot click anywhere. Hard reset required.
I found someone else with what appears to be the exact same issue, there's an uploaded image of it but I don't know if it was python causing it for him/her. https://askubuntu.com/questions/918261/why-does-my-cursor-keep-changing-to-a-black-cross-and-how-do-i-revert-it
If I use my keyboard and re-run it again, I get this error:
import-im6.q16: unable to grab mouse `': Resource temporarily unavailable @ error/xwindow.c/XSelectWindow/9182.
回答1:
You're not running Python! You're accidentally running this as a shell script. Run it as
python bug.py
or include the shebang line:
#!/usr/bin/env python
Currently, you seem to be running a completely unrelated program named import, designed for screen capture.
来源:https://stackoverflow.com/questions/45849176/just-writing-import-in-a-python-script-breaks-my-mouse-cursor-forcing-a-hard-r