X-Git-Url: https://wagner.pp.ru/gitweb/?a=blobdiff_plain;f=ljdump.py;fp=ljdump.py;h=0ab61ec5c79ba6a480479afbca76a245b66a3e24;hb=bd071668c8d0fcebb52ae072f2524e0bc772deb1;hp=fbae90ad37f5cacbe938c1069e1ce949e7bca9d2;hpb=acf8f188feeb3d368a97ca90cc54f098dcae94ce;p=oss%2Fljdump.git diff --git a/ljdump.py b/ljdump.py index fbae90a..0ab61ec 100755 --- a/ljdump.py +++ b/ljdump.py @@ -284,7 +284,13 @@ for p in userpics: print >>f, """""" % (p, userpics[p]) pic = urllib2.urlopen(userpics[p]) ext = MimeExtensions.get(pic.info()["Content-Type"], "") - picf = open("%s/%s%s" % (Username, codecs.utf_8_decode(p)[0], ext), "wb") + try: + picfn = codecs.utf_8_decode(p)[0] + picf = open("%s/%s%s" % (Username, picfn, ext), "wb") + except: + # for installations where the above utf_8_decode doesn't work + picfn = "".join([ord(x) < 128 and x or "?" for x in p]) + picf = open("%s/%s%s" % (Username, picfn, ext), "wb") shutil.copyfileobj(pic, picf) pic.close() picf.close()