Wow, I've really been posting to this list a lot today. I guess free-time to post is what results when I happen to be working with a column with an agonizingly slow flow-through.

So anyway, since I didn't want to post both the question and my own interpretation of the answer in the same message, here's my stab at the problem.

It sounds like you're trying to execute the commands Warren referenced you to from within PyMol itself. Unless I'm mistaken, you should instead create a file "povray.py" (your python script for outputting the povray .pov file) that contains entire

import string
f=open("test.pov",'w')
f.write(string.join(cmd.get_povray(),'\n'))
f.close()

So here's what the above script does line by line...although it's not very conventional, I've preceded each line of the script with "**", and the comment of what that line accomplishes with a "#".

**import string
# I'm not totally familiar with Python, but I'm guessing this contains the tools you need to wrote what is known as "strings", basically just text rather than numbers

**f=open("test.pov",'w')
# create a file named test.pov (the POVRay file that you will render from) and prepare to write to it

**f.write(string.join(cmd.get_povray(),'\n'))
# in a nutshell, this fills test.pov with the actual guts of your POVRay file. The problem with cmd.get_povray() is that when Warren says it returns a "tuple of strings", he really means "enough strings to fill a multi-megabyte file". Before I went to PyMol, I used to make 20MB MegaPOVRay include files for images of molecular surfaces. If you don't stuff this massive bit of text to a file, it's not much use to you.

**f.close()
# we're all done, so go ahead and close test.pov

So once you've made your script (povray.py), you should get your molecule all ready, and then execute povray.py. This will create the file test.pov, containing all of the coordinates POVRay will need to do the raytracing.

Well, that was my shot at it! Anyone else have something to add?

Jacob

I was just in contact with Bronwyn Carlisle, who is having some problems posting questions to the PyMol mailing list. He had the following question and asked me to post it for him:

::begin B. Carlisle quote::
Also, I'd like to use POVRay to render pics, but I have POVRay for MacOS
already and don't want to lose it, and when I try to install POVRay for
XFree86 it won't do it because of the previous version.  Is there any
way around this?  It would be nice if Pymol would export POV files like
Swiss PDB viewer does!

And this is what he said:

cmd.get_povray() will return a tuple of strings containing PovRay input.
Just write that out to a file:

# povray.py

import string
f=open("test.pov",'w')
f.write(string.join(cmd.get_povray(),'\n'))
f.close()

I am not at all familiar with these sorts of commands - I have used Unix
a little but I'm mostly a Mac person and this Linux/python stuff is
totally foreign to me.  So I'm not sure if I can just go
cmd.get_povray() or if I have to do the whole
import string
f=open("test.pov",'w')
f.write(string.join(cmd.get_povray(),'\n'))
f.close()
thing.  I sort of figured that the 4 line version includes saving it to
file - but I have no idea where it would end up!  And in any case I
tried both and in each case it tells me:

Traceback (most recent call last):
File "/usr/local/pymol/modules/pymol/parser.py", line 208, in parse
exec(com2[nest],pymol_names,pymol_names)
File "<string>", line 1, in ?
AttributeError: get_povray

after the line containing cmd.get_povray.  I am assuming that python
doesn't understand get_povray without being told to?  So how do I tell
it to?  Or whatever.

Bronwyn Carlisle
Biochemistry Department
University of Otago
Dunedin
New Zealand

Tel 64 3 479 7704
::end B. Carlisle quote::
--
Jacob Corn
Gladstone Institute of Neurological Disease
415.695.3745
jc...@gladstone.ucsf.edu

_______________________________________________
PyMOL-users mailing list
PyMOL-users@lists.sourceforge.net
https://lists.sourceforge.net/lists/listinfo/pymol-users

--
Jacob Corn
Gladstone Institute of Neurological Disease
415.695.3745
jc...@gladstone.ucsf.edu

Reply via email to