Exemplo n.º 1
0
def ex(e):
	"""
	Returns a unicode string from the exception text if it exists.
	"""
	
	# sanity check
	if not e.args or not e.args[0]:
		return ""

	e_message = fixStupidEncodings(e.args[0], True)
	
	# if fixStupidEncodings doesn't fix it then maybe it's not a string, in which case we'll try printing it anyway
	if not e_message:
		try:
			e_message = str(e.args[0])
		except:
			e_message = ""
	
	return e_message
	
Exemplo n.º 2
0
#!/usr/bin/python
# Author: cytec <*****@*****.**>
# URL: http://github.com/cytec/SynoDLNAtrakt/
#
# This file is part of SynoDLNAtrakt.

import os

from synodlnatrakt import config
from synodlnatrakt import encodingKludge as ek

print config.SYS_ENCODING

buggyname = "Hawaii.Five-0.s02e14.Das.P\xc3\xa4ckchen.SD.TV.avi"

try:
    fixedname = ek.ek(os.path.abspath, buggyname)
except:
    fixedname = ek.fixStupidEncodings(buggyname)


print buggyname, fixedname