From ecf2c3afd6c7e81a2dbfab9ab434ea6e5ee0eeac Mon Sep 17 00:00:00 2001 From: Maurice Raybaud <mauriceraybaud@hotmail.fr> Date: Wed, 6 Apr 2011 15:18:15 +0000 Subject: [PATCH] Further Error handling to allow win 32 bits blender builds to render with Povray 64 bits and the other way around. --- render_povray/render.py | 61 +++++++++++++++++++++++++++-------------- 1 file changed, 40 insertions(+), 21 deletions(-) diff --git a/render_povray/render.py b/render_povray/render.py index 9ff96ad18..f449d7b14 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -1638,60 +1638,79 @@ class PovrayRender(bpy.types.RenderEngine): regKey = winreg.OpenKey(winreg.HKEY_CURRENT_USER, "Software\\POV-Ray\\v3.7\\Windows") - #64 bits blender + # TODO, report api + + # 64 bits blender if bitness == 64: try: pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64" + self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) + # This would work too but means we have to wait until its done: + # os.system("%s %s" % (pov_binary, self._temp_file_ini)) + except OSError: # someone might run povray 32 bits on a 64 bits blender machine try: pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine" + self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) + except OSError: + # TODO, report api print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary) + import traceback + traceback.print_exc() + print ("***-DONE-***") + return False + else: print("POV-Ray 3.7 64 bits could not execute, running 32 bits instead") + print("Command line arguments passed: " + str(extra_args)) + return True + else: print("POV-Ray 3.7 64 bits found") - + print("Command line arguments passed: " + str(extra_args)) + return True + #32 bits blender else: try: pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine" + self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) + # someone might also run povray 64 bits with a 32 bits build of blender. except OSError: try: pov_binary = winreg.QueryValueEx(regKey, "Home")[0] + "\\bin\\pvengine64" + self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) + except OSError: + # TODO, report api print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary) + import traceback + traceback.print_exc() + print ("***-DONE-***") + return False + else: print("Running POV-Ray 3.7 64 bits build with 32 bits Blender, \nYou might want to run Blender 64 bits as well.") + print("Command line arguments passed: " + str(extra_args)) + return True + else: print("POV-Ray 3.7 32 bits found") + print("Command line arguments passed: " + str(extra_args)) + return True + else: # DH - added -d option to prevent render window popup which leads to segfault on linux extra_args.append("-d") - # print("Extra Args: " + str(extra_args)) - - if 1: - # TODO, when POV-Ray isn't found this gives a cryptic error, would be nice to be able to detect if it exists - try: - self._process = subprocess.Popen([pov_binary, self._temp_file_ini] + extra_args) # stdout=subprocess.PIPE, stderr=subprocess.PIPE - except OSError: - # TODO, report api - print("POV-Ray 3.7: could not execute '%s', possibly POV-Ray isn't installed" % pov_binary) - import traceback - traceback.print_exc() - print ("***-DONE-***") - return False - - else: - # This works too but means we have to wait until its done - os.system("%s %s" % (pov_binary, self._temp_file_ini)) + # TODO, when POV-Ray isn't found this can probably still give a cryptic error on linux, + # would be nice to be able to detect if it exists - # print ("***-DONE-***") - return True + print("Command line arguments passed: " + str(extra_args)) def _cleanup(self): for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out): -- GitLab