Path: csiph.com!x330-a1.tempe.blueboxinc.net!usenet.pasdenom.info!aioe.org!news.stack.nl!newsfeed.xs4all.nl!newsfeed5.news.xs4all.nl!xs4all!post.news.xs4all.nl!not-for-mail Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.005 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:module': 0.04; 'raises': 0.07; 'subject:object': 0.07; 'python': 0.08; '"class"': 0.09; 'callable.': 0.09; 'class,': 0.15; "subject:' ": 0.15; '"module"': 0.16; 'instantiate': 0.16; 'wrote:': 0.16; 'appears': 0.20; 'wrote': 0.20; 'subject:not': 0.21; 'file,': 0.21; 'header :In-Reply-To:1': 0.22; '\xa0if': 0.23; 'pm,': 0.24; 'aug': 0.24; 'code': 0.25; 'code.': 0.26; "i'm": 0.27; 'thu,': 0.28; 'correct': 0.28; 'import': 0.28; 'importing': 0.29; 'message- id:@mail.gmail.com': 0.29; 'print': 0.29; 'imported': 0.30; 'typeerror:': 0.30; 'class': 0.30; 'received:209.85.161.46': 0.31; 'received:mail-fx0-f46.google.com': 0.31; 'list': 0.32; 'does': 0.32; 'there': 0.33; 'to:addr:python-list': 0.33; 'file.': 0.34; 'like:': 0.34; 'object': 0.35; 'received:209.85.161': 0.35; 'problem.': 0.36; 'file': 0.36; 'think': 0.38; 'received:google.com': 0.38; 'received:209.85': 0.38; 'subject:: ': 0.39; 'to:addr:python.org': 0.39; 'more': 0.60; 'your': 0.61; '11,': 0.68; 'future,': 0.76; '\xa0also,': 0.84; 'resides': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=gamma; h=mime-version:in-reply-to:references:date:message-id:subject:from:to :content-type:content-transfer-encoding; bh=mKWr2qHlvb5xM2MVIWd9aH4iozhbv1Ul+P106qJ2Te8=; b=AOEzLLXrjGriI1ewgKXk6fyIBehDXYCFLd3Vg+KHrHKucezxJS+6JODyXzfqaFqI/E Af43s5NMXmLjDrc4j1iQrdQIrQ5OfRjHlJwwzMWGjJ9kbvJwi3udo0dH/Ylfh5QypLW5 oEsmp9dVhpcC/Ld4//GlNBTXUzhLdnT/fGWG4= MIME-Version: 1.0 In-Reply-To: References: Date: Thu, 11 Aug 2011 20:15:39 -0400 Subject: Re: TypeError: 'module' object is not callable From: David Robinow To: python-list@python.org Content-Type: text/plain; charset=ISO-8859-1 Content-Transfer-Encoding: quoted-printable X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.12 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , Newsgroups: comp.lang.python Message-ID: Lines: 28 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1313108141 news.xs4all.nl 23916 [2001:888:2000:d::a6]:41704 X-Complaints-To: abuse@xs4all.nl Xref: x330-a1.tempe.blueboxinc.net comp.lang.python:11240 On Thu, Aug 11, 2011 at 6:43 PM, Forafo San wrote: > I wrote a class, Univariate, that resides in a directory that is in my PY= THONPATH. I'm able to >import that class into a *.py file. However when I t= ry to instantiate an object with that class like: What makes you think you're able to import that class? > x =3D Univariate(a) =A0 =A0 =A0 =A0 =A0 =A0 # a is a list that is expecte= d by the Univariate class > > python raises the TypeError: 'module' object is not callable. =A0If I emb= ed the code of the Univariate >class in my *.py file, there is no problem. = =A0Also, when the class is imported and I do a > > print dir(Univariate) > > it does not print all the methods that are in the class, while if the cla= ss code appears in my *.py >file, all the methods are available and a list = with the correct methods are printed. It appears that you are importing the "module" Univariate from the file Univariate.py If you want to instantiate the "class" Univariate contained in the "module" Univariate, try x =3D Univariate.Univariate(a) In the future, please try to include more of your code.