Path: csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail From: Chris Angelico Newsgroups: comp.lang.python Subject: Re: How to call a Python Class? Date: Wed, 4 May 2016 09:14:40 +1000 Lines: 13 Message-ID: References: <1659145888.152847.1462316185321.JavaMail.yahoo.ref@mail.yahoo.com> <1659145888.152847.1462316185321.JavaMail.yahoo@mail.yahoo.com> Mime-Version: 1.0 Content-Type: text/plain; charset=UTF-8 X-Trace: news.uni-berlin.de bgmsVxmEvkGnr5cCxMHdiwi5HIN8RFGuW2ugXqrQ0DeA== Return-Path: X-Original-To: python-list@python.org Delivered-To: python-list@mail.python.org X-Spam-Status: OK 0.002 X-Spam-Evidence: '*H*': 1.00; '*S*': 0.00; 'received:209.85.223': 0.03; 'subject:Python': 0.05; 'cc:addr:python-list': 0.09; 'subject:How': 0.09; 'python': 0.10; 'wed,': 0.15; 'file,': 0.15; '.py': 0.16; '2016': 0.16; 'from:addr:rosuav': 0.16; 'from:name:chris angelico': 0.16; 'help?': 0.16; 'intersection': 0.16; 'magic': 0.16; 'received:io': 0.16; 'received:psf.io': 0.16; 'wrote:': 0.16; 'script.': 0.18; 'cc:2**0': 0.20; 'cc:addr:python.org': 0.20; '"",': 0.22; 'am,': 0.23; 'tried': 0.24; 'import': 0.24; '(most': 0.24; 'header:In-Reply-To:1': 0.24; 'software.': 0.25; 'message-id:@mail.gmail.com': 0.27; "skip:' 10": 0.28; 'class': 0.33; 'source': 0.33; 'message.': 0.33; 'open': 0.33; 'file': 0.34; 'received:google.com': 0.35; 'but': 0.36; 'received:209.85': 0.36; 'subject:?': 0.36; 'subject:: ': 0.37; 'received:209': 0.38; 'files': 0.38; 'within': 0.64; 'python-list': 0.66; 'regards.': 0.67; 'chrisa': 0.84; 'to:none': 0.91; 'subject:Class': 0.91 DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=gmail.com; s=20120113; h=mime-version:in-reply-to:references:date:message-id:subject:from:cc; bh=rKmO1CH7JYoD4EGihvl3yoENOCtYVt7U/yYrJqLUZrU=; b=Ft21mxY4MBpdw7SelIa5icnufpCg/TvT8UAbb38XURkHhty0m10uc1Dg0GapMc8P7F TtoIzx2dp0u43i1PwFm1XJl0B5YAAgcGhmDJvIoK++im1mQHLVDknKieYNfjTG48tS9H +e4hJCjnb8o4Gqau/Tmsd4BlCzRCso65+1VFPW67h5mQBF9t/rrj1hQ9dmsemSgFI5RW mfpJ+OpeFKBMRtIqHcR4VJlUUExmIwiXHPBGYmpdEdFIr7wzUflKTUjxCloQIZH9R9jS TkB2z3E2vYmsY8A5vcPo8MU0PXKx9HNkSHWEPpKb2ZhdFpqtt+STfdEoA/BVRw/uMIAY +uCg== X-Google-DKIM-Signature: v=1; a=rsa-sha256; c=relaxed/relaxed; d=1e100.net; s=20130820; h=x-gm-message-state:mime-version:in-reply-to:references:date :message-id:subject:from:cc; bh=rKmO1CH7JYoD4EGihvl3yoENOCtYVt7U/yYrJqLUZrU=; b=kEm+tHA0BBNqnu86vkiB7CS1SOrQ9Qz5Qv6NNWqpAlsqesArboY5Ne6yHI3l6Nfg61 zgr9UidO0zY2r59MRf4GltND+68490wSqc+AnbQzDB2CEBMjs6UaaQ6HkA1PnrQejEud Tnq5cxEbn/y65F01mBIExXvHA28h4S/aqEHr63Ctw98hAQPBL4tY7T8lFK1xDX8HPv/o VjjeiXT0V2Feh+Q2YiV79NtxtlLK3tYh/QX9c+LAsODGK6a1FC27wDiZBGQguclb4WTM v8JXlpEUJzWKjPKq3iPPAU4uzeJYidLg+cbQqEYnjLjqwhaBrS/6KtlaxiV4rtGJBiwX I9gw== X-Gm-Message-State: AOPr4FUxviKt+BA+c+sqoNx2I2ZPeLm0lVHBAvpIrobi55SMSozG/Kewoj/tb4sI/K30sRtE8zL93/3RKR9TqA== X-Received: by 10.107.169.13 with SMTP id s13mr6243570ioe.19.1462317280664; Tue, 03 May 2016 16:14:40 -0700 (PDT) In-Reply-To: <1659145888.152847.1462316185321.JavaMail.yahoo@mail.yahoo.com> X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.22 Precedence: list List-Id: General discussion list for the Python programming language List-Unsubscribe: , List-Archive: List-Post: List-Help: List-Subscribe: , X-Mailman-Original-Message-ID: X-Mailman-Original-References: <1659145888.152847.1462316185321.JavaMail.yahoo.ref@mail.yahoo.com> <1659145888.152847.1462316185321.JavaMail.yahoo@mail.yahoo.com> Xref: csiph.com comp.lang.python:108104 On Wed, May 4, 2016 at 8:56 AM, David Shi via Python-list wrote: > I found a Python class within an Open Source software. > I would like to use it in my own Python script. > I tried to import it, but I got following message. > from intersection import *Traceback (most recent call last): File "", line 1, in from intersection import *ImportError: bad magic number in 'intersection': b'\x03\xf3\r\n' > Can any one help? > Regards. Did you get a .py file, or only a .pyc? Try deleting all .pyc files that you downloaded, and try again. ChrisA