Replace "print" calls with sys.stderr.{write,flush}()

- Debug messages should go to the stderr rather than to the stdout
- Plus, Python 3 has replaced the built-in "print" with a new
  function, whose syntax is quite different.
This commit is contained in:
Alessio Treglia 2011-12-08 11:10:13 +01:00
parent affc44313a
commit aadb58e15e
2 changed files with 5 additions and 2 deletions

View File

@ -35,7 +35,8 @@ class config(object):
with open (config_filename) as config_file:
self.appdict = yaml.load (config_file)
except:
print "Config file doesn't exist, creating a new one..."
sys.stderr.write("Config file doesn't exist, creating a new one...\n")
sys.stderr.flush()
self.appdict = dict ()
# Returns the section named <app_name> from the global config

View File

@ -16,6 +16,7 @@
# along with this program. If not, see <http://www.gnu.org/licenses/>.
import dbus
import sys
name_base = 'org.jackaudio'
controller_interface_name = name_base + '.JackControl'
@ -30,7 +31,8 @@ class jack_controller:
# self.bus.add_signal_receiver (self.name_owner_changed, dbus_interface = controller_interface_name, signal_name = "NameOwnerChanged")
def name_owner_changed (name = None, old_owner = None, new_owner = None):
print "Name changed : %r" % name
sys.stderr.write("Name changed : %r\n" % name)
sys.stderr.flush()
def is_available (self):
try: