1

I ran vapory sample code in github, but it has errors.

  • 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)
    
  • Error Message

     Traceback (most recent call last):
    File "C:\scene1.py", line 60, in <module>
    scene.render("scene1_vapory.png", width=640, height=480)
    File "C:\Users\User\Anaconda3\lib\site-packages\vapory\vapory.py", line 102, in render
    quality, antialiasing, remove_temp)
    File "C:\Users\User\Anaconda3\lib\site-packages\vapory\io.py", line 106, in render_povstring
    stdout=subprocess.PIPE)
    File "C:\Users\User\Anaconda3\lib\subprocess.py", line 775, in __init__
    restore_signals, start_new_session)
    File "C:\Users\User\Anaconda3\lib\subprocess.py", line 1178, in _execute_child
    startupinfo)
    FileNotFoundError: [WinError 2] The system cannot find the file specified
    
DYZ
  • 55,249
  • 10
  • 64
  • 93
Ping Zhang
  • 53
  • 4

2 Answers2

2

You first need to install POV-Ray. See here for the Windows binaries. Then, You need to change the POVRAY_BINARY variable in config.py with the actual binary path of POV-RAY installation.

  1. Get the path of the executable of POV-RAY.

  2. Go to C:\Users\user_name\AppData\Local\Programs\Python\Python37-32\Lib\site- packages\vapory\config.py

  3. Replace POVRAY_BINARY = ("povray.exe" if os.name=='nt' else "povray") with POVRAY_BINARY = "POV-RAY binary path"

the POV-RAY path will be like : C:\Program Files\POV-Ray\v3.7\bin\pvengine.exe

Mo'men Ahmed
  • 61
  • 1
  • 4
  • Hmm... My "config.py" for vapory places in Python path on the drive D:. I replace this string with actual path of POV-Ray but I get the same errors one-by-one as above. – javierMarquez Dec 04 '21 at 18:54
1

For Windows 7 path to POV-Ray binary should be with "/" instead of "", something like that:

POVRAY_BINARY = "C:/Program Files/POV-Ray/v3.7/bin/pvengine.exe"

INFO: http://zulko.github.io/blog/2014/11/13/things-you-can-do-with-python-and-pov-ray/

javierMarquez
  • 142
  • 2
  • 10