Fix err undefined exception.
This commit is contained in:
parent
6f8e7b4694
commit
ee00bc8881
@ -10,7 +10,7 @@
|
|||||||
# the Free Software Foundation; either version 2 of the License, or
|
# the Free Software Foundation; either version 2 of the License, or
|
||||||
# (at your option) any later version.
|
# (at your option) any later version.
|
||||||
#
|
#
|
||||||
# This program is distributed in the hope that it will be useful,
|
# This program is distributed in the hope that it will be useful,
|
||||||
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
# but WITHOUT ANY WARRANTY; without even the implied warranty of
|
||||||
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
|
||||||
# GNU General Public License for more details.
|
# GNU General Public License for more details.
|
||||||
@ -73,7 +73,7 @@ def find_folder( filename):
|
|||||||
try:
|
try:
|
||||||
if os.path.isdir(filename):
|
if os.path.isdir(filename):
|
||||||
return(filename)
|
return(filename)
|
||||||
except UnicodeError:
|
except UnicodeError as err:
|
||||||
LOG.error("Filename %s raised a Unicode Error %s", repr(filename), err)
|
LOG.error("Filename %s raised a Unicode Error %s", repr(filename), err)
|
||||||
|
|
||||||
LOG.debug("Filename %s either not found or not a directory.",
|
LOG.debug("Filename %s either not found or not a directory.",
|
||||||
@ -91,7 +91,7 @@ def get_empty_tempdir(dirname):
|
|||||||
""" Return path to TEMP_DIR/dirname, a guaranteed empty directory
|
""" Return path to TEMP_DIR/dirname, a guaranteed empty directory
|
||||||
|
|
||||||
makes intervening directories if required
|
makes intervening directories if required
|
||||||
fails if _file_ by that name already exists,
|
fails if _file_ by that name already exists,
|
||||||
or for inadequate permissions to delete dir/files or create dir(s)
|
or for inadequate permissions to delete dir/files or create dir(s)
|
||||||
|
|
||||||
"""
|
"""
|
||||||
@ -121,10 +121,10 @@ def relative_path(original, base):
|
|||||||
return original
|
return original
|
||||||
original = os.path.normpath(original)
|
original = os.path.normpath(original)
|
||||||
base = os.path.normpath(base)
|
base = os.path.normpath(base)
|
||||||
|
|
||||||
# If the db_dir and obj_dir are on different drives (win only)
|
# If the db_dir and obj_dir are on different drives (win only)
|
||||||
# then there cannot be a relative path. Return original obj_path
|
# then there cannot be a relative path. Return original obj_path
|
||||||
(base_drive, base) = os.path.splitdrive(base)
|
(base_drive, base) = os.path.splitdrive(base)
|
||||||
(orig_drive, orig_name) = os.path.splitdrive(original)
|
(orig_drive, orig_name) = os.path.splitdrive(original)
|
||||||
if base_drive.upper() != orig_drive.upper():
|
if base_drive.upper() != orig_drive.upper():
|
||||||
return original
|
return original
|
||||||
@ -133,7 +133,7 @@ def relative_path(original, base):
|
|||||||
# shared by base and target.
|
# shared by base and target.
|
||||||
base_list = (base).split(os.sep)
|
base_list = (base).split(os.sep)
|
||||||
target_list = (orig_name).split(os.sep)
|
target_list = (orig_name).split(os.sep)
|
||||||
# make sure '/home/person' and 'c:/home/person' both give
|
# make sure '/home/person' and 'c:/home/person' both give
|
||||||
# list ['home', 'person']
|
# list ['home', 'person']
|
||||||
base_list = [_f for _f in base_list if _f]
|
base_list = [_f for _f in base_list if _f]
|
||||||
target_list = [_f for _f in target_list if _f]
|
target_list = [_f for _f in target_list if _f]
|
||||||
@ -178,7 +178,7 @@ def search_for(name):
|
|||||||
return 1
|
return 1
|
||||||
if os.access(name, os.X_OK) and not os.path.isdir(name):
|
if os.access(name, os.X_OK) and not os.path.isdir(name):
|
||||||
return 1
|
return 1
|
||||||
else:
|
else:
|
||||||
for i in os.environ['PATH'].split(':'): #not win()
|
for i in os.environ['PATH'].split(':'): #not win()
|
||||||
fname = os.path.join(i, name)
|
fname = os.path.join(i, name)
|
||||||
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
|
if os.access(fname, os.X_OK) and not os.path.isdir(fname):
|
||||||
|
Loading…
Reference in New Issue
Block a user