vapory icon indicating copy to clipboard operation
vapory copied to clipboard

povray not found

Open wanglongqi opened this issue 9 years ago • 15 comments

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?

wanglongqi avatar Jun 24 '15 07:06 wanglongqi

Try to add this at the beginning of your script:

import povray.config as config
config.POVRAY_BINARY = "path/to/the/povray/binary"

Zulko avatar Jun 24 '15 07:06 Zulko

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?

wanglongqi avatar Jun 24 '15 07:06 wanglongqi

I think there are several ways to deal with this problem:

  1. only output the pov file. Let the user to do the rest.
  2. add an option for custom povray installation. Just a suggestion.

wanglongqi avatar Jun 24 '15 07:06 wanglongqi

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.

Zulko avatar Jun 24 '15 09:06 Zulko

OK, I will start a PR to see whether these ideas are suitable.

wanglongqi avatar Jun 24 '15 10:06 wanglongqi

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.

  1. Modified config.py (povray to pvengine)
  2. 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 () 7 8 scene = Scene( camera, objects= [light, sphere] ) ----> 9 scene.render("purple_sphere.png", width=400, height=300 )

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

jagmohan-nanaware avatar Jun 06 '16 04:06 jagmohan-nanaware

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.

arizhakov avatar Apr 18 '17 15:04 arizhakov

On Windows 10 with POV-Ray 3.7beta - the binary is pvengine.exe or pvengine64.exe

not povray.exe ...

EricPoehlsen avatar May 27 '18 07:05 EricPoehlsen

EricPoehlsen, does it work for you now? I have changed "povray" to "pvengine" where applicable in the config file but still not working.

Appaullingly avatar May 29 '18 15:05 Appaullingly

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.

Appaullingly avatar May 30 '18 15:05 Appaullingly

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"

EricPoehlsen avatar Jun 03 '18 12:06 EricPoehlsen

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")

augustosisa avatar Jun 10 '18 19:06 augustosisa

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

sunandir avatar Sep 16 '18 13:09 sunandir

anyone knows the binary on macOS?

ben-mengz avatar Jun 26 '20 13:06 ben-mengz

@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.

yw-fang avatar Jun 26 '20 15:06 yw-fang