On Mon, 05 Dec 2016 16:25:56 -0500, DFS wrote: > On 12/05/2016 03:58 PM, Wildman wrote: >> I there a way to detect what the Linux runlevel is from >> within a Python program? I would like to be able to do >> it without the use of an external program such as 'who' >> or 'runlevel'. > > > Why not? > > '>>> import os > '>>> os.system("systemctl get-default") > graphical.target > > > > systemd 'graphical.target' corresponds to the old runlevel 5.
Thanks but I knew about systemctl. As I already said my goal is to do it without the use of an external program. -- <Wildman> GNU/Linux user #557453 The cow died so I don't need your bull! -- https://mail.python.org/mailman/listinfo/python-list