PrintLog.py 681 B

1234567891011121314151617181920212223242526272829
  1. #! /usr/bin/env python
  2. # -*- coding: utf-8 -*-
  3. # COPYRIGHT: Openmoko Inc. 2009
  4. # LICENSE: GPL Version 3 or later
  5. # DESCRIPTION: Article Rendering
  6. # AUTHORS: Sean Moss-Pultz <sean@openmoko.com>
  7. # Christopher Hall <hsw@openmoko.com>
  8. import sys, os
  9. # overcome Pythons buggy unicode handling in print statements
  10. def message(data):
  11. if type(data) == unicode:
  12. sys.stdout.write(data.encode('utf-8'))
  13. else:
  14. sys.stdout.write(data)
  15. sys.stdout.write('\n')
  16. sys.stdout.flush()
  17. def message_no_newline(data):
  18. if type(data) == unicode:
  19. sys.stdout.write(data.encode('utf-8'))
  20. else:
  21. sys.stdout.write(data)
  22. sys.stdout.flush()