1

I was just learning how to use povray with python. I used a simple code found online exploiting vapory but it doesn't work. HERE IS THE CODE

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)

HERE IS THE ERROR

Traceback (most recent call last):
  File "c:\Users\danie\Desktop\tesi\Codice\mmmm", line 8, in <module>
    scene.render("purple_sphere.png", width=400, height=300)
  File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\vapory\vapory.py", line 92, in render
    return render_povstring(str(self), outfile, height, width,
  File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\site-packages\vapory\io.py", line 120, in render_povstring
    process = subprocess.Popen(cmd, stderr=subprocess.PIPE,
  File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 969, in __init__
    self._execute_child(args, executable, preexec_fn, close_fds,
  File "C:\Users\danie\AppData\Local\Programs\Python\Python310\lib\subprocess.py", line 1438, in _execute_child
    hp, ht, pid, tid = _winapi.CreateProcess(executable, args,
FileNotFoundError: [WinError 2] The system cannot find the file specified

I have already changed the POVRAY_BINARY in config.py but it still doesn't work. Thank you all

  • I'm not a Windows user, so I might be mistaken... Is your povray executable reachable on the 'path'? I mean, can you execute povray from the command prompt? Also, I believe that even in Windows, you still have to define paths in Python have to use '/', not the backslash. Python translates this to the correct / for each OS. – jcoppens Dec 06 '22 at 14:24
  • Also: http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/ – jcoppens Dec 06 '22 at 14:28

0 Answers0