import treecutter.constants as const
from treecutter.image import Image
+from treecutter.tools import warning
class Docbook():
"""Class representing a docbook document"""
(stdout, stderr) = xml.communicate()
#print xml.returnvalue
if stderr:
- print " ".join(exe)+" ERROR : [ "+stderr+" ]"
+ warning("%s : %s" % (" ".join(exe),stderr))
+ warning(stdout)
exit
os.chdir(cwd)
te = time()
#!/usr/bin/python
+from __future__ import print_function
import os
import subprocess
import errno
+import sys
def mkdir_p(path):
try:
cmd = ["rsync","-a","--delete",src,target]
retcode = subprocess.call(cmd)
if retcode:
- print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']'
+ error('%s : retruncode %s' % (' '.join(cmd),str(retcode)))
def ssh_cmd(target, command):
t = target.split(":")
cmd = ["ssh",t[0],c[0],c[1],t[1]]
retcode = subprocess.call(cmd)
if retcode:
- print 'Error: '+' '.join(cmd)+' Returncode ['+str(retcode)+']'
+ error('%s : retruncode %s' % (' '.join(cmd),str(retcode)))
def sizeof_fmt(num, suffix='B'):
for unit in ['','Ki','Mi','Gi','Ti','Pi','Ei','Zi']:
elif os.path.isdir(itempath):
total_size += get_folder_size(itempath)
return total_size
+
+def warning(*objs):
+ print("WARNING: ", *objs, file=sys.stderr)
+
+def error(*objs):
+ print("ERROR: ", *objs, file=sys.stderr)