Skip to content

Commit

Permalink
Fix linux terminal output encoding
Browse files Browse the repository at this point in the history
  • Loading branch information
fedosov committed Sep 3, 2013
1 parent e5628a2 commit 885cef8
Showing 1 changed file with 5 additions and 2 deletions.
7 changes: 5 additions & 2 deletions updates.py
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
#!/usr/bin/env python
# -*- coding: utf-8 -*-
__author__ = "Mikhail Fedosov ([email protected])"
__version__ = "0.1.3.3"
__version__ = "0.1.3.4"

# http://code.activestate.com/recipes/577708-check-for-package-updates-on-pypi-works-best-in-pi/
# http://stackoverflow.com/questions/287871/print-in-terminal-with-colors-using-python
Expand All @@ -12,6 +12,9 @@
import xmlrpclib
from multiprocessing import Pool

reload(sys)
sys.setdefaultencoding("utf-8")

class colors:
""" Colored terminal text
"""
Expand Down Expand Up @@ -75,7 +78,7 @@ def check_package(dist):
msg = u"{colors.FAIL}{symbols.FAIL}timeout{colors.ENDC}".format(colors=colors, symbols=symbols)

if msg:
print(u"{dist.project_name:26} {colors.BOLD}{dist.version:12}{colors.ENDC} {msg}".format(colors=colors, dist=dist, msg=msg))
print((u"{dist.project_name:26} {colors.BOLD}{dist.version:16}{colors.ENDC} {msg}".format(colors=colors, dist=dist, msg=msg)).encode("utf-8", "replace"))

def main():
socket.setdefaulttimeout(5.0)
Expand Down

0 comments on commit 885cef8

Please sign in to comment.