On Nov 29, 9:51 am, Benjamin Hell <bh...@spamfence.netwrote:
Hi!
I wonder whether there might be a way to find out how a Python
program was started (in my case in Windows): By double clicking the
file or by calling it on the "DOS" command line prompt.
I think it's not possible (or very tricky) to do that.
Background: I would like to have the program run in an "interactive
mode" if double clicked, and silently in a "batch mode" when started
otherwise.
Any hints?
Why don't you just create a desktop icon that calls "myprog.py --
interactive-mode" and then check in sys.argv for the actual argument?
Or, if you prefer not to use arguments, you could just change the
working directory of the shortcut and then check os.getcwd()? Though
it's a weird thing to do...
Hope I could.
aatiis