[Biopython] error object is not callable, but callable() returns True
Romelia Salomon
romeliasalomon at gmail.com
Tue Dec 3 16:34:30 UTC 2013
Thanks Peter!
It works perfectly now.
On Tue, Dec 3, 2013 at 2:31 AM, Peter Cock <p.j.a.cock at googlemail.com>wrote:
> On Mon, Dec 2, 2013 at 11:43 PM, Romelia Salomon
> <romeliasalomon at gmail.com> wrote:
> > Hi
> >
> > I am having problems using biopython on my laptop. I have Python version
> > v2.6 and I recently installed biopython 1.53-1 using synaptic (I am using
> > Ubuntu), but I can't get it to work right, I am having a problem running
> > even the examples in the tutorial.
> >
> > When I try to use any of the command line wrappers I get an error saying
> > the object is not callable, even though when I check that same object
> with
> > callable() it does seem to be callable. For example:
> >
> > mycomputer$ python
> > Python 2.6.5 (r265:79063, Sep 26 2013, 18:48:04)
> > [GCC 4.4.3] on linux2
> > Type "help", "copyright", "credits" or "license" for more information.
> >>>> from Bio.Align.Applications import MuscleCommandline
> >>>> muscle_cline = MuscleCommandline(input="opuntia.fasta")
> >>>> stdout, stderr = muscle_cline()
> > Traceback (most recent call last):
> > File "<stdin>", line 1, in <module>
> > TypeError: 'MuscleCommandline' object is not callable
> >>>> callable(MuscleCommandline)
> > True
> >
> > Thanks for your help!
>
> Hi Romelia,
>
> The simple answer is from the FAQ (in the current Biopython Tutorial),
> http://biopython.org/DIST/docs/tutorial/Tutorial.html
>
> "Why can’t I run command line tools directly from the application wrappers?
> You need Biopython 1.55 or later. Alternatively, use the Python
> subprocess module directly."
>
> You are using Biopython 1.53 (which is now four years old), and it
> doesn't have the __call__ method defined which made the class
> callable in this way. Your investigation *almost* identified the
> problem, but the key test you missed was:
>
> callable(muscle_cline)
>
> Unfortunately checking callable(MuscleCommandline) just confirmed
> you can invoke MuscleCommandline(...) which you did to create
> the object stored as muscle_cline.
>
> So, I would suggest you uninstall the (very old) Ubunutu Biopython
> (using 'sudo apt-get remove python-biopython') and then instead
> install the current release from source. See:
> http://biopython.org/wiki/Download#Ubuntu_or_Debian
>
> Regards,
>
> Peter
>
--
****************************************
Dr. Romelia Salomon Ferrer
Nagarajan Research Group
Immunology Department
City of Hope
More information about the Biopython
mailing list