Hello,
Is there a way to detect Python scripts execution environment, that is interactive (from a terminal session) or directly from Domoticz
Thank you
How to detect Python execution environment
Moderator: leecollings
-
- Posts: 374
- Joined: Friday 23 May 2014 7:55
- Target OS: Linux
- Domoticz version: 2022.1
- Location: Saint Pierre de Jards
- Contact:
How to detect Python execution environment
Debian buster on NUC and three RPi with buster.
- waaren
- Posts: 6028
- Joined: Tuesday 03 January 2017 14:18
- Target OS: Linux
- Domoticz version: Beta
- Location: Netherlands
- Contact:
Re: How to detect Python execution environment
@Number8,
do you mean
$which python3.5
/usr/local/bin/python3.5
$which python
/usr/bin/python
$python --version
Python 2.7.12
$python3.5 --version
Python 3.5.1
do you mean
$which python3.5
/usr/local/bin/python3.5
$which python
/usr/bin/python
$python --version
Python 2.7.12
$python3.5 --version
Python 3.5.1
Debian buster, bullseye on RPI-4, Intel NUC.
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
dz Beta, Z-Wave, RFLink, RFXtrx433e, P1, Youless, Hue, Yeelight, Xiaomi, MQTT
==>> dzVents wiki
Re: How to detect Python execution environment
or:
/usr/bin/env python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
/usr/bin/env python
Python 2.7.6 (default, Oct 26 2016, 20:30:19)
[GCC 4.8.4] on linux2
Type "help", "copyright", "credits" or "license" for more information.
-
- Posts: 374
- Joined: Friday 23 May 2014 7:55
- Target OS: Linux
- Domoticz version: 2022.1
- Location: Saint Pierre de Jards
- Contact:
Re: How to detect Python execution environment
Thanks for your replies. However this is not what I'm looking for. Inside a script, I want to detect whether Python has been launched from a terminal session (SSH), that is with direct user interaction, or from a control within Domoticz?
Is there a way to detect that?
Is there a way to detect that?
Debian buster on NUC and three RPi with buster.
Re: How to detect Python execution environment
Shell variable PPID -> parent pid
So 'echo $PPID' gives the parent PID, go from there.
So 'echo $PPID' gives the parent PID, go from there.
-
- Posts: 374
- Joined: Friday 23 May 2014 7:55
- Target OS: Linux
- Domoticz version: 2022.1
- Location: Saint Pierre de Jards
- Contact:
Re: How to detect Python execution environment
Thanks EddyG, this is the idea I was looking for.
Debian buster on NUC and three RPi with buster.
Who is online
Users browsing this forum: Google [Bot] and 1 guest