[minor] change filename to unicode after os.walk and os.listdir

This commit is contained in:
Anand Doshi 2013-10-01 17:11:39 +05:30
parent 49e71400ac
commit b6177cbb5b
3 changed files with 4 additions and 0 deletions

View File

@ -96,6 +96,7 @@ def backup_to_dropbox():
error_log = []
path = os.path.join(get_base_path(), "public", "files")
for filename in os.listdir(path):
filename = cstr(filename)
if filename in ignore_list:
continue

View File

@ -85,6 +85,7 @@ def backup_to_gdrive():
webnotes.conn.close()
path = os.path.join(get_base_path(), "public", "files")
for filename in os.listdir(path):
filename = cstr(filename)
found = False
filepath = os.path.join(path, filename)
ext = filename.split('.')[-1]

View File

@ -9,6 +9,7 @@ from __future__ import unicode_literals
import os, json
from xml.etree import ElementTree as ET
from webnotes.utils.datautils import read_csv_content
from webnotes.utils import cstr
path = "/Users/rmehta/Downloads/openerp/openerp/addons"
chart_roots = []
@ -108,6 +109,7 @@ def find_charts():
basename = os.path.basename(basepath)
if basename.startswith("l10n"):
for fname in files:
fname = cstr(fname)
filepath = os.path.join(basepath, fname)
if fname.endswith(".xml"):
tree = ET.parse(filepath)