[Bf-extensions-cvs] SVN commit: /data/svn/bf-extensions [1298] trunk/py/scripts/addons/ render_povray/render.py: changes from r1294,
Campbell Barton
ideasman42 at gmail.com
Wed Dec 22 05:52:08 CET 2010
Revision: 1298
http://projects.blender.org/plugins/scmsvn/viewcvs.php?view=rev&root=bf-extensions&revision=1298
Author: campbellbarton
Date: 2010-12-22 05:52:05 +0100 (Wed, 22 Dec 2010)
Log Message:
-----------
changes from r1294,
- be explicit with exceptions. new exceptions can be accounted for as needed
- self._process was being checked for None, this should never happen, if it does then that is a bug and should be dealt with separately.
Modified Paths:
--------------
trunk/py/scripts/addons/render_povray/render.py
Modified: trunk/py/scripts/addons/render_povray/render.py
===================================================================
--- trunk/py/scripts/addons/render_povray/render.py 2010-12-21 22:38:30 UTC (rev 1297)
+++ trunk/py/scripts/addons/render_povray/render.py 2010-12-22 04:52:05 UTC (rev 1298)
@@ -106,7 +106,7 @@
if filename in names:
pahFile = os.path.join(root, filename)
return pahFile
- except: #OSError: #was that the proper error type?
+ except OSError:
return ''
def path_image(image):
@@ -127,8 +127,10 @@
# Level=2 is for texture with translation of spec and mir levels for when no map influences them
# Level=3 is for texture with Maximum Spec and Mirror
try:
- if int(name) > 0: prefix='shader'
- except: prefix=''
+ if int(name) > 0:
+ prefix='shader'
+ except:
+ prefix = ''
prefix='shader_'
if Level == 2:
return prefix+name
@@ -612,12 +614,12 @@
matrix = ob.matrix_world
try:
uv_layer = me.uv_textures.active.data
- except:
+ except AttributeError:
uv_layer = None
try:
vcol_layer = me.vertex_colors.active.data
- except:
+ except AttributeError:
vcol_layer = None
faces_verts = [f.vertices[:] for f in me.faces]
@@ -1275,7 +1277,7 @@
try:
os.remove(self._temp_file_out) # so as not to load the old file
- except: #OSError: #was that the proper error type?
+ except OSError:
pass
write_pov_ini(self._temp_file_ini, self._temp_file_in, self._temp_file_out)
@@ -1321,7 +1323,6 @@
for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out):
try:
os.remove(f)
- pass
except OSError: #was that the proper error type?
pass
@@ -1358,15 +1359,14 @@
# print("***POV WAITING FOR FILE***")
if self.test_break():
try:
- # DH - added various checks for _process and some debug output print()s
- if self._process: self._process.terminate()
+ self._process.terminate()
print("***POV INTERRUPTED***")
- except: #OSError: #was that the proper error type?
+ except OSError:
pass
break
poll_result = self._process.poll()
- if self._process and poll_result != None:
+ if poll_result is not None:
print("***POV PROCESS FAILED : %s ***" % poll_result)
self.update_stats("", "POVRAY 3.7: Failed")
break
@@ -1386,7 +1386,7 @@
# possible the image wont load early on.
try:
lay.load_from_file(self._temp_file_out)
- except: #OSError: #was that the proper error type?
+ except SystemError:
pass
self.end_result(result)
@@ -1395,7 +1395,7 @@
# print("***POV RENDER LOOP***")
# test if povray exists
- if self._process and self._process.poll() != None:
+ if self._process.poll() is not None:
print("***POV PROCESS FINISHED***")
update_image()
break
@@ -1403,9 +1403,9 @@
# user exit
if self.test_break():
try:
- if self._process: self._process.terminate()
+ self._process.terminate()
print("***POV PROCESS INTERRUPTED***")
- except: #OSError: #was that the proper error type?
+ except OSError:
pass
break
More information about the Bf-extensions-cvs
mailing list