Commit 930ea79f authored by Vitor Lopes's avatar Vitor Lopes

os.popen() has been deprecated

parent 42e99b7d
......@@ -12,6 +12,9 @@
import gi
gi.require_version('Gtk', '3.0')
from gi.repository import Gtk, GObject
# os.popen() has been deprecated since Python 2.6.
# You should now use the subprocess module instead:
import subprocess
import os
from gi.repository.GdkPixbuf import Pixbuf
import platform
......@@ -80,8 +83,10 @@ class MyWindow(Gtk.Window):
# Checking to see if the package is already installed
# and packing the appropriate button/label
self.installedlabel1 = Gtk.Label("Installed")
chromium = os.popen("pacman -Q chromium | awk '{print $1}'").read()
if chromium == 'chromium\n':
# this is a better way of doing it, not tested
process = subprocess.Popen("pacman -Q chromium | awk '{print $1}'", stdout=subprocess.PIPE, stderr=None, shell=True)
output = process.communicate()
if "error was not found" not in output:
self.chromebox.pack_end(self.installedlabel1, False, False, 0)
self.chromebox.pack_end(self.chromebutton, False, False, 0)
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment