move from os.popen and os.popen2 to subproces.Popen for 2.6 compatibility as they've been deprecated

This commit is contained in:
Marcos Pinto 2008-07-15 22:29:35 +00:00
parent 67ee5000ad
commit aaad0651e2
3 changed files with 8 additions and 5 deletions

View File

@ -34,6 +34,7 @@
"""Common functions for various parts of Deluge to use.""" """Common functions for various parts of Deluge to use."""
import os import os
import subprocess
import pkg_resources import pkg_resources
import xdg, xdg.BaseDirectory import xdg, xdg.BaseDirectory
@ -146,7 +147,7 @@ def open_file(path):
if windows_check(): if windows_check():
os.startfile("'%s'" % path) os.startfile("'%s'" % path)
else: else:
os.popen("xdg-open '%s'" % path) subprocess.Popen(["xdg-open", "%s" % path])
def open_url_in_browser(url): def open_url_in_browser(url):
"""Opens link in the desktop's default browser""" """Opens link in the desktop's default browser"""

View File

@ -36,6 +36,7 @@ import pkg_resources
import gobject import gobject
import socket import socket
import os import os
import subprocess
import time import time
import threading import threading
@ -127,7 +128,7 @@ class ConnectionManager(component.Component):
if deluge.common.windows_check(): if deluge.common.windows_check():
win32api.WinExec("deluged -p 58846") win32api.WinExec("deluged -p 58846")
else: else:
os.popen("deluged -p 58846") subprocess.Popen(["deluged", "-p 58846"])
time.sleep(0.1) time.sleep(0.1)
# We need to wait for the host to start before connecting # We need to wait for the host to start before connecting
while not self.test_online_status(uri): while not self.test_online_status(uri):
@ -162,7 +163,7 @@ class ConnectionManager(component.Component):
if deluge.common.windows_check(): if deluge.common.windows_check():
win32api.WinExec("deluged -p %s" % port) win32api.WinExec("deluged -p %s" % port)
else: else:
os.popen("deluged -p %s" % port) subprocess.Popen(["deluged", "-p %s" % port])
# We need to wait for the host to start before connecting # We need to wait for the host to start before connecting
while not self.test_online_status(uri): while not self.test_online_status(uri):
time.sleep(0.01) time.sleep(0.01)
@ -437,7 +438,7 @@ class ConnectionManager(component.Component):
if deluge.common.windows_check(): if deluge.common.windows_check():
win32api.WinExec("deluged -p %s" % port) win32api.WinExec("deluged -p %s" % port)
else: else:
os.popen("deluged -p %s" % port) subprocess.Popen(["xdg-open", "-p %s" % port])
def on_button_close_clicked(self, widget): def on_button_close_clicked(self, widget):
log.debug("on_button_close_clicked") log.debug("on_button_close_clicked")

View File

@ -31,6 +31,7 @@
# statement from all source files in the program, then also delete it here. # statement from all source files in the program, then also delete it here.
import os import os
import subprocess
import traceback import traceback
import random import random
from operator import attrgetter from operator import attrgetter
@ -211,7 +212,7 @@ def daemon_start_localhost(port):
port = str(port) port = str(port)
log.info("Starting localhost:%s daemon..", port) log.info("Starting localhost:%s daemon..", port)
# Spawn a local daemon # Spawn a local daemon
os.popen("deluged -p %s" % port) subprocess.Popen(["deluged", "-p %s" % port])
def daemon_connect(uri): def daemon_connect(uri):
if config.get('daemon') <> uri: if config.get('daemon') <> uri: