Hi,
When you call cmd.extend(), it does not add the function to pymol.cmd. 
Just call it directly:

Change
  pymol.cmd.align_all_to_all()
to
align_all_to_all()

You may need to import it if you haven't already (and make sure it is in 
the PYTHONPATH).

HTH,
Matt Baumgartner


On 09/02/2014 10:38 AM, Jose Manuel Gally wrote:
> Dear Pymol mailing list,
>
> I am facing a problem with some python scripting involving pymol...
>
> I have a python script which adds a new function to pymol
> (align_all_to_all.py that I found on pymolwiki).
> I added some features to it so that it can load pdbs and thus automate
> the calculations.
>
> Whenever I run the script, I get this error:
> Traceback (most recent call last):
>     File "calculateRMSD_04.py", line 145, in <module>
>       pymol.cmd.align_all_to_all()
> AttributeError: 'module' object has no attribute 'align_all_to_all'
>
> However, the align_all_to_all function is correctly added to pymol
> functions (autocompletion works in the displayed session).
> I guess the problem comes from how I call it in the script, but so far I
> couldn't figure what is the problem....
>
> I am very new to both pymol and python, so any help would be much
> appreciated!
>
> Cheers,
> Jose Manuel
>
> Here is the relevent part of the script:
> #### SCRIPT ####
>       import __main__
> #    __main__.pymol_argv = ['pymol','-cq'] # Pymol: quiet and no GUI
> import pymol, commented for debugging
>
> # Initialisation
>       import pymol
>       pymol.finish_launching()
>       pymol.cmd.extend('align_all_to_all',align_all_to_all)    # add
> function into pymol commands
>
> # Load all pdbs listed in the input file
>       for pdb in list_pdb:
>           pdbfile =  path + pdb + ".pdb"
>           pymol.cmd.load(pdbfile, pdb)
>
> # Compute RMSD
>
>       pymol.cmd.align_all_to_all()
>       pymol.cmd.quit()
>
> ------------------------------------------------------------------------------
> Slashdot TV.
> Video for Nerds.  Stuff that matters.
> http://tv.slashdot.org/
> _______________________________________________
> 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


------------------------------------------------------------------------------
Slashdot TV.  
Video for Nerds.  Stuff that matters.
http://tv.slashdot.org/
_______________________________________________
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