various py3k incompatibilities removed
authorAnton Dutov <anton@dutov.org>
Mon, 09 Nov 2009 23:31:37 +0200
changeset 97 46afc08b68ff
parent 96 82aaeccffbec
child 98 f215aef1d1ee
various py3k incompatibilities removed
opster.py
--- a/opster.py	Sun Oct 11 14:19:47 2009 +0300
+++ b/opster.py	Mon Nov 09 23:31:37 2009 +0200
@@ -220,13 +220,13 @@
         --pid-file   name of file to write process ID to
     <BLANKLINE>
     '''
-    print '%s\n' % usage
+    write(usage + '\n')
     doc = func.__doc__
     if not doc:
         doc = '(no help text available)'
-    print '%s\n' % doc.strip()
+    write(doc.strip() + '\n')
     if options:
-        print ''.join(help_options(options))
+        write(''.join(help_options(options)))
 
 def help_options(options):
     yield 'options:\n\n'
@@ -284,7 +284,7 @@
         # copy defaults to state
         if isinstance(default, list):
             state[pyname] = default[:]
-        elif callable(default):
+        elif hasattr(default, '__call__'):
             funlist.append(pyname)
             state[pyname] = None
         else: