Can I know who run the current python script in windows?

  python, scheduled-tasks, windows

I have a function in python, that I sometimes run manually and sometimes run automatically with windows task schedualer. I want some functionality to be different depending on the way it is run. Can I do something within the function that would tell me how it was run?

The reason I need to know that, is that when I run it manually, I want to double-check with the user (e.g me) that I want to proceed with some data over-ridding, but when it is run automatically, no-one would be there to confirm (and as it is done automatically, it was probably done right).

Source: Windows Questions

LEAVE A COMMENT