Hello,

It is much easier than that.

Make a pymol script, for example, test.pml:

#
load 3gbn.pdb
select Selection1, resi 80:115
save Selection1.cif, Selection1
quit
#

then run it with the -c option : 
pymol test.pml -c

If you want to pass an argument, like the filename of a pdb file to be directly 
opened, then use the -cp option.

Florian

> On 9 Dec 2024, at 22:38, Yarrow Madrona <yarrowmadr...@gmail.com> wrote:
> 
> I'm trying to run pymol in batch mode without launching the window. I am 
> running PyMOL 3.1.1.
> 
> Here is my code for an example script (test.py). I'm trying to run before 
> running the real script. In the command line I enter:
> pymol -cq test.py
> 
> 
> from pymol import cmd
> import time
> 
> def main():
>     print("Starting PyMOL batch processing...")
>     cmd.load("3gbn.pdb")
>     do_stuff()
>     print("Loaded 3gbn.pdb")
>     time.sleep(25)  # Ensure commands are processed
>     cmd.quit()
> 
> if __name__ == "__main_":
>     main()
> I don't get any output. If I type:
> pymol -c test.py
> It appears that pymol starts and closes:
> 
> <image.png>
> 
> Any help on how to run a python script with pymol in batch without opening 
> the GUI would be appreciated.
> Yarrow
> 
> _______________________________________________
> 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

_______________________________________________
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