Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Why does running my Python script start taking a screenshot? [closed]

Tags:

python

I'm writing a script in Python, but when I attempt to run it a cross cursor appears and lets me take screenshots. But that's not part of my program, and the rest of the script never executes at all!

The minimal code that produces this behavior is:

import fiona
import scipy
like image 576
estebarb Avatar asked May 08 '15 20:05

estebarb


People also ask

How do I keep a Python script running?

sleep() Function To Run Script repeatedly. So, if you do not want to use the above code and just want to run your script repeatedly then you can use the time. sleep() function. This function allows your script to keep running after sleeping for a certain amount of time.

Can Python take a screenshot?

Take screenshot with PIL in Python Similarly to the pyautogui solution, PIL allows to take a screenshot using Python in three lines of code as well.

How do I know if Python script is running in the background?

I usually use ps -fA | grep python to see what processes are running. The CMD will show you what python scripts you have running, although it won't give you the directory of the script. Save this answer.

What happens if you change a Python script while its running?

Nothing, because Python precompiles your script into a PYC file and launches that. However, if some kind of exception occurs, you may get a slightly misleading explanation, because line X may have different code than before you started the script.


1 Answers

It's a known issue which regularly happens to some.

Without a python shebang line the script is treated as a shell script. And line import module is treated as a command to run import application, which is present on your system (part of ImageMagick, I guess) and makes a screenshot saving it to the specified file.

like image 104
warvariuc Avatar answered Oct 20 '22 17:10

warvariuc