It looks like strftime('%s') is not valid on Windows (it works fine for me on 
Linux and macOS). Here is an equivalent alternative that works on all platforms:

    filename = '~/pymol-auto-save-{}.pse'.format(int(time.time()))
    filename = os.path.expanduser(filename)

Binding a key is also easy. Here is an example which binds saving and rendering 
to the F1 key:

python
@cmd.set_key('F1')
def autosave_and_render():
    filename = os.path.expanduser('~/pymol-auto-save.pse')
    cmd.set('pse_binary_dump')
    cmd.save(filename, quiet=0)
    cmd.ray()
python end


Hope that helps.

Cheers,
  Thomas


> On Nov 22, 2019, at 11:48 PM, Junsu Park aka. Jason Mosier 
> <parksinj...@gmail.com> wrote:
> 
> Hello, I'm fairly new to pymol and python in general, but I honestly don't 
> have to self control to save by myself very well and so I was trying to use 
> the proof of concept code for autosaving. However, it was written for a way 
> old version of pymol and so I was wondering if I could get some help with 
> fixing this code up? If that would be too difficult, is there a way that I 
> could bind a key to saving AND then rendering? Or even just clicking on the 
> render button causes it to save before ray tracing? I keep rendering on a 
> weak computer thinking it can handle it and then it crashes and I lose all my 
> progress.
> 
> Link to code: https://pastebin.com/EJJQWc00  
> Link to output:  https://pastebin.com/TNSuA0fH
> 
> Thanks,
> -Jason
> _______________________________________________
> PyMOL-users mailing list
> Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
> Unsubscribe: 
> https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

--
Thomas Holder
PyMOL Principal Developer
Schrödinger, Inc.



_______________________________________________
PyMOL-users mailing list
Archives: http://www.mail-archive.com/pymol-users@lists.sourceforge.net
Unsubscribe: 
https://sourceforge.net/projects/pymol/lists/pymol-users/unsubscribe

Reply via email to