I think that the problem is that python is interpreting part of your directories as special characters. This is due to the fact that Windows uses the backslash as the directory separator which is also a special character in python (and in *nix systems).

In a regular python terminal, if I do:

print "C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4))

I get:
C:\\Users\\Brenton\\Documents\\Chem Structures\\PDBs*\x02\x02*HYY - imatinib\\PyMOL movie\\Image0003.png

Which is not a directory. To fix this, make the string a raw string (https://docs.python.org/2/reference/lexical_analysis.html#string-literals) by adding a 'r' before the string like:

print *r*'C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png'.format(str(i).zfill(4))

Now we get the correct directory:
C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image0003.png


Matt Baumgartner

On 01/06/2015 11:14 AM, Brenton Horne wrote:
I checked, it's not the problem, sadly. Anyway, the first line, outside the loop, which has the same location saves to Image0001.png just fine in the correct location without that directory error.

On 7/01/2015 2:11 AM, Matthew Baumgartner wrote:
I think that is because that the directory there doesn't exist. I think I made a copy paste error of your directory structure.

Please double check, but from your earlier email, it was

C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\



On 1/6/15, 11:08 AM, Brenton Horne wrote:
I should add that this error occurs for each loop.

On 7/01/2015 2:05 AM, Brenton Horne wrote:
This script gives the error (after the first frame that occurs before the loop):

ScenePNG-Error: error writing "C:\Users\Brenton\Documents\Chem Structures\PDBsHYY - imatinib\PyMOL movie\Image0060.png"! Please check directory...


On 7/01/2015 1:52 AM, Matthew Baumgartner wrote:
Be sure to reply to the list so everyone can benefit from the questions and answers.

Ah, as Tsjerk mentioned, you need to wrap it in a python-python end block.


set ray_opaque_background, 0

png C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image0001.png, dpi=300, ray=1

python
for i in range(2,61):
    cmd.rotate('y', 6)
cmd.png("C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4)), dpi=300, ray=1)
python end


On 01/06/2015 10:40 AM, Brenton Horne wrote:
Sure is this is my code atm:

set ray_opaque_background, 0

png C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image0001.png, dpi=300, ray=1

for i in range(2,61):

    rotate y, 6

cmd.png("C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4)), dpi=300, ray=1)


On 7/01/2015 1:33 AM, Matthew Baumgartner wrote:
Is it in your for loop?

for i in range(2,61):
    rotate y, 6
cmd.png("C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4)), dpi=300, ray=1)

On 1/6/15, 10:13 AM, Brenton Horne wrote:
That gave the error:

cmd.png("C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4)), dpi=300, ray=1)
Traceback (most recent call last):
File "C:\Python27\lib\site-packages\pymol\parser.py", line 464, in parse
exec(layer.com2+"\n",self.pymol_names,self.pymol_names)
  File "<string>", line 1, in <module>
NameError: name 'i' is not defined

On 7/01/2015 1:03 AM, Matthew Baumgartner wrote:
cmd.png("C:\Users\Brenton\Documents\Chem Structures\PDBs\2\2HYY - imatinib\PyMOL movie\Image{}.png".format(str(i).zfill(4)), dpi=300, ray=1)












------------------------------------------------------------------------------
Dive into the World of Parallel Programming! The Go Parallel Website,
sponsored by Intel and developed in partnership with Slashdot Media, is your
hub for all things parallel software development, from weekly thought
leadership blogs to news, videos, case studies, tutorials and more. Take a
look and join the conversation now. http://goparallel.sourceforge.net
_______________________________________________
PyMOL-users mailing list (PyMOL-users@lists.sourceforge.net)
Info Page: https://lists.sourceforge.net/lists/listinfo/pymol-users
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net

Reply via email to