[Edu-sig] Re: VPython

Scott David Daniels Scott.Daniels at Acm.Org
Wed Jun 2 09:26:26 EDT 2004

Kirby Urner wrote:
>>I do know the pov-ray people have been pretty insistent on making sure
>>nobody repackages it in a way you don't see their interface.  I think
>>we'd need to wait for the repackaging they are in the midst of.
 > I think it's fine to invoke povray from within Python using os.system
 > or some such.  Povray remains an independent program with its own
 > identity.

I know we are free individually to make these changes.  However, I'd
like some clarification to verify the command-line thing-ami-bob would
not incur their ire (I'm unclear where they draw the line, and they
have felt very burned at least a few times).

> I have a pov.py that looks like this, which might give some ideas.  But yes,
> in this version the paths to the pvengine are hardcoded.  It'd take some
> doing (not a lot) to make this more friendly to configure (not my need at
> this time).  But at least I test for which operating system (no Mac option
> as yet).
> def render(filename="default.pov"):
>     if os.name == 'linux2':
>         linuxcomm = "povray +V +W640 +H480 +FN16 +AM2 +Q9 +A0.3 +P
> +L/home/urnerk/include"
>         print "Rendering... (this will take some time)"
>         os.system(linuxcomm+" +I"+filename)
>     if os.name == 'nt':
>         wincomm = '"c:\\program files\\POV-Ray for Windows
> v3.5\\bin\\pvengine" -V fpp.ini'
>         print "Rendering... (this will take some time)"
>         # os.system(wincomm+" +I"+filename)
>         os.system(wincomm)

How about something like:

     def render(filename="default.pov"):
         if os.name == 'linux2':
             cmd = ("povray +V +W640 +H480 +FN16 +AM2 "
                    "+Q9 +A0.3 +P +L/home/urnerk/include +I"
                    + filename)
         elif os.name == 'nt':
             cmd = ('"c:\\program files\\POV-Ray for '
                    'Windows v3.5\\bin\\pvengine" -V fpp.ini')
             # or use r'HKLM\SOFTWARE\Classes\Applications'
             #        r'\pvengine.exe\shell\RenderAndExit\command'
             raise NotImplementedError, 'Not ready for os %r' % os.name

         print "Rendering... (this will take some time)"

-Scott David Daniels
Scott.Daniels at Acm.Org

More information about the Edu-sig mailing list