diff options
author | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2011-04-24 17:03:31 +0400 |
---|---|---|
committer | Maurice Raybaud <mauriceraybaud@hotmail.fr> | 2011-04-24 17:03:31 +0400 |
commit | 8dc8d57607caf457902fb2123ecd640b88b8db27 (patch) | |
tree | 67d8edc0bf4e865f5265b0f2a894190a7a3ef806 | |
parent | d96d9d390eb25b7fc920cf28a25447638e1b261e (diff) |
Added Linux Binary detection thanks to Bela Mihalik's patch.
-rw-r--r-- | render_povray/render.py | 33 |
1 files changed, 30 insertions, 3 deletions
diff --git a/render_povray/render.py b/render_povray/render.py index 3ac7b48c..cfdfddf9 100644 --- a/render_povray/render.py +++ b/render_povray/render.py @@ -1707,10 +1707,37 @@ class PovrayRender(bpy.types.RenderEngine): # DH - added -d option to prevent render window popup which leads to segfault on linux extra_args.append("-d") - # 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 + isExists = False + sysPathList = os.getenv("PATH").split(':') + sysPathList.append("") - print("Command line arguments passed: " + str(extra_args)) + for dirName in sysPathList: + if (os.path.exists(os.path.join(dirName, pov_binary))): + isExists = True + break + + if not isExists: + print("POV-Ray 3.7: could not found execute '%s' - not if PATH" % pov_binary) + import traceback + traceback.print_exc() + print ("***-DONE-***") + return False + + try: + 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'" % pov_binary) + import traceback + traceback.print_exc() + print ("***-DONE-***") + return False + + else: + print("POV-Ray 3.7 found") + print("Command line arguments passed: " + str(extra_args)) + return True def _cleanup(self): for f in (self._temp_file_in, self._temp_file_ini, self._temp_file_out): |