0

changed bare exceptions to except Exception

This commit is contained in:
Andrew Brown
2011-10-26 22:36:23 -04:00
parent b31160e3ad
commit f5ae4b3451
4 changed files with 8 additions and 8 deletions

View File

@@ -139,7 +139,7 @@ def main():
print "Git commit: %s" % overviewer_version.HASH print "Git commit: %s" % overviewer_version.HASH
print "built on %s" % overviewer_version.BUILD_DATE print "built on %s" % overviewer_version.BUILD_DATE
print "Build machine: %s %s" % (overviewer_version.BUILD_PLATFORM, overviewer_version.BUILD_OS) print "Build machine: %s %s" % (overviewer_version.BUILD_PLATFORM, overviewer_version.BUILD_OS)
except: except Exception:
print "version info not found" print "version info not found"
pass pass
sys.exit(0) sys.exit(0)

View File

@@ -2255,7 +2255,7 @@ def prepareBiomeData(worlddir):
try: try:
grasscolor = list(Image.open(os.path.join(biomeDir,"grasscolor.png")).getdata()) grasscolor = list(Image.open(os.path.join(biomeDir,"grasscolor.png")).getdata())
foliagecolor = list(Image.open(os.path.join(biomeDir,"foliagecolor.png")).getdata()) foliagecolor = list(Image.open(os.path.join(biomeDir,"foliagecolor.png")).getdata())
except: except Exception:
# clear anything that managed to get set # clear anything that managed to get set
grasscolor = None grasscolor = None
foliagecolor = None foliagecolor = None
@@ -2316,7 +2316,7 @@ def loadLightColor():
lightcolor_checked = True lightcolor_checked = True
try: try:
lightcolor = list(_load_image("light_normal.png").getdata()) lightcolor = list(_load_image("light_normal.png").getdata())
except: except Exception:
logging.warning("Light color image could not be found.") logging.warning("Light color image could not be found.")
lightcolor = None lightcolor = None
return lightcolor return lightcolor

View File

@@ -52,7 +52,7 @@ def findGitHash():
try: try:
import overviewer_version import overviewer_version
return overviewer_version.HASH return overviewer_version.HASH
except: except Exception:
return "unknown" return "unknown"
def findGitVersion(): def findGitVersion():
@@ -68,9 +68,9 @@ def findGitVersion():
# and 0.1.3 into 0.1.3 # and 0.1.3 into 0.1.3
line = '-'.join(line.split('-', 2)[:2]) line = '-'.join(line.split('-', 2)[:2])
return line.strip() return line.strip()
except: except Exception:
try: try:
import overviewer_version import overviewer_version
return overviewer_version.VERSION return overviewer_version.VERSION
except: except Exception:
return "unknown" return "unknown"

View File

@@ -142,7 +142,7 @@ except AttributeError:
try: try:
pil_include = os.environ['PIL_INCLUDE_DIR'].split(os.pathsep) pil_include = os.environ['PIL_INCLUDE_DIR'].split(os.pathsep)
except: except Exception:
pil_include = [ os.path.join(get_python_inc(plat_specific=1), 'Imaging') ] pil_include = [ os.path.join(get_python_inc(plat_specific=1), 'Imaging') ]
if not os.path.exists(pil_include[0]): if not os.path.exists(pil_include[0]):
pil_include = [ ] pil_include = [ ]
@@ -221,7 +221,7 @@ def generate_version_py():
f = open("overviewer_core/overviewer_version.py", "w") f = open("overviewer_core/overviewer_version.py", "w")
f.write(outstr) f.write(outstr)
f.close() f.close()
except: except Exception:
print "WARNING: failed to build overviewer_version file" print "WARNING: failed to build overviewer_version file"
class CustomSDist(sdist): class CustomSDist(sdist):