vapory
vapory copied to clipboard
povray not found
Due to the problem described here, python does not search all env paths:
Due to the differences in the underlying implementation, subprocess.Popen will only search the path by default on non-Windows systems. The only reliable cross-platform way to scan the path is by passing shell=True to the subprocess call, but that has its own issues (as detailed in the Popen documentation)
Currently, I can not render scene with default package, which end up with
OSError: [Errno 2] No such file or directory
Any option can fix this problem?
Try to add this at the beginning of your script:
import povray.config as config
config.POVRAY_BINARY = "path/to/the/povray/binary"
Yes, I have done that. Actually, I directly edited the source file of config.py
, but I think it is not that friendly. So we do not have other option to get rid of this problem?
I think there are several ways to deal with this problem:
- only output the pov file. Let the user to do the rest.
- add an option for custom
povray
installation. Just a suggestion.
For (1) it doesn't seem very practical. For (2) maybe, but I don't know how to do it, if you find a nice way I'll merge it.
OK, I will start a PR to see whether these ideas are suitable.
Level: Novice (with python as well as vapory/Pov-ray; Otherwise good C/C++ and embedded systems programmer) Purpose: Learning (both python and vapory) Problem: I am stuck with error Platform: Windows + ipython (python 2.7)
Can anyone help me in solving this correctly?
Script:
LET'S DRAW A PURPLE SPHERE !
from vapory import *
camera = Camera( 'location', [0, 2, -3], 'look_at', [0, 1, 2] ) light = LightSource( [2, 4, -3], 'color', [1, 1, 1] ) sphere = Sphere( [0, 1, 2], 2, Texture( Pigment( 'color', [1, 0, 1] )))
scene = Scene( camera, objects= [light, sphere] ) scene.render("purple_sphere.png", width=400, height=300 )
It did not work and is not working even after when I tried various options suggested here.
- Modified config.py (povray to pvengine)
- Added following to the script import povray.config as config config.POVRAY_BINARY = "C:\Program Files\POV-Ray\v3.7\bin"
I am still getting following error when I try to run following script Output with modification 1 above
WindowsError Traceback (most recent call last)
D:\linked folders\personal-documents\personal\tools\python\Continuum\Anaconda\lib\site-packages\vapory__init__.pyc in
D:\linked folders\personal-documents\personal\tools\python\Continuum\Anaconda\lib\site-packages\vapory\vapory.pyc in render(self, outfile, height, width, quality, antialiasing, remove_temp, auto_camera_angle) 100 101 return render_povstring(str(self), outfile, height, width, --> 102 quality, antialiasing, remove_temp) 103 104
D:\linked folders\personal-documents\personal\tools\python\Continuum\Anaconda\lib\site-packages\vapory\io.pyc in render_povstring(string, outfile, height, width, quality, antialiasing, remove_temp) 104 process = subprocess.Popen(cmd, stderr=subprocess.PIPE, 105 stdin=subprocess.PIPE, --> 106 stdout=subprocess.PIPE) 107 108 out, err = process.communicate(string.encode('ascii'))
D:\linked folders\personal-documents\personal\tools\python\Continuum\Anaconda\lib\subprocess.pyc in init(self, args, bufsize, executable, stdin, stdout, stderr, preexec_fn, close_fds, shell, cwd, env, universal_newlines, startupinfo, creationflags) 708 p2cread, p2cwrite, 709 c2pread, c2pwrite, --> 710 errread, errwrite) 711 except Exception: 712 # Preserve original exception in case os.close raises.
D:\linked folders\personal-documents\personal\tools\python\Continuum\Anaconda\lib\subprocess.pyc in _execute_child(self, args, executable, preexec_fn, close_fds, cwd, env, universal_newlines, startupinfo, creationflags, shell, to_close, p2cread, p2cwrite, c2pread, c2pwrite, errread, errwrite) 956 env, 957 cwd, --> 958 startupinfo) 959 except pywintypes.error, e: 960 # Translate pywintypes.error to WindowsError, which is
WindowsError: [Error 2] The system cannot find the file specified
For what it's worth, I was able to resolve this type of problem by adding export POVRAY_BINARY="path/to/the/povray/binary"
to ~/.bashrc
.
On Windows 10 with POV-Ray 3.7beta - the binary is pvengine.exe or pvengine64.exe
not povray.exe ...
EricPoehlsen, does it work for you now? I have changed "povray" to "pvengine" where applicable in the config file but still not working.
It works for me when I add the following just before the subprocess in io.py POVRAY_BINARY = r"C:\Program Files\POV-Ray\v3.7\bin\pvengine64.exe" including the .exe and the raw string.
Yep, I got it working, comment was meant for other people who might stumble into that problem ...
I just updated the config.py with: POVRAY_BINARY = "C:/Program Files/POV-Ray/v3.7-beta/bin/pvengine64.exe"
Hi, this works for me too in Windows.
But I made some little changes to allow different installations of POV-RAY. I add to environment variable PATH the folder "C:\Program Files\POV-Ray\v3.7\bin" and edit the definition ofpovray_binary on file config.py as:
POVRAY_BINARY = ("pvengine64.exe" if os.name=='nt' else "pvengine")
Good night.... I have a problem rendering povray v3.6 Which is marked in yellow....I try again and it's Always wrong,Are there any brothers who can solve my problem ?
I use Windows 10 And thisis the error message #ifndef(pack_P1) #declare global_pack_P1=yes; object {RES_DIS_POT_ALPHA("POTMETER_ALPHA",)translate<0,0,0> rotate<0,0.000000,0>rotate<0,0.000000,0> rotate<0,0,0> translate<11.430000,0.000000,26.670000>translate<0,0.035000,0> }#end //ALPHA tipusu femhazas potmeter P1 POTMETER_ALPHA ALPHA
anyone knows the binary on macOS?
@ben-laofu In my case, it's in "/usr/local/bin/povray". You can use "which povray" to locate it. If you cannot find it, you may refer to google to figure it out.