Path: csiph.com!v102.xanadu-bbs.net!xanadu-bbs.net!goblin2!goblin.stu.neva.ru!newsfeed.xs4all.nl!newsfeed3.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.004 X-Spam-Evidence: '*H*': 0.99; '*S*': 0.00; 'subject:Python': 0.05; 'importerror:': 0.05; 'main()': 0.07; 'problem?': 0.07; 'python': 0.09; 'def': 0.10; 'advance.': 0.15; 'to:name:python-list': 0.15; '"is"': 0.16; '#create': 0.16; '1):': 0.16; 'main():': 0.16; 'subject:Problem': 0.16; 'wrote:': 0.17; 'jan': 0.18; 'math': 0.20; 'email addr:gmail.com>': 0.20; 'trying': 0.21; 'import': 0.21; 'to:2**1': 0.23; 'header:In-Reply-To:1': 0.25; 'message- id:@mail.gmail.com': 0.27; 'url:mailman': 0.29; 'skip:_ 10': 0.29; 'skip:& 10': 0.29; 'class': 0.29; "i'm": 0.29; 'function': 0.30; 'url:python': 0.32; 'file': 0.32; 'url:listinfo': 0.32; '11,': 0.33; 'to:addr:python-list': 0.33; 'received:google.com': 0.34; 'thanks': 0.34; 'same.': 0.35; 'pm,': 0.35; 'received:209.85': 0.35; 'url:org': 0.36; 'subject:with': 0.36; 'keeps': 0.37; 'received:209': 0.37; 'subject:: ': 0.38; 'object': 0.38; 'to:addr:python.org': 0.39; 'url:mail': 0.40; 'solve': 0.62; 'here': 0.65; 'circle': 0.65; '100': 0.78; '2013': 0.84; 'saying:': 0.84 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:to :content-type; bh=PfM0uGB4aXztnUwRzbYX47INBchMpbSrWnfo/GNtIks=; b=bA7wAWRHkPY/MV3GZG0lRwoZYgUBKQjbMG8SqPK8UC6zXUVwPexhunOSdvr9kJ/s3H dtmLTUsU51EWGRGPX7TlhZD9bZ1fKfKnCx5OjmcqKPeK8W5PhvH9jgYZsTc1kYtGVqHX IFt+vYBZMCWGuvVgos4QyE5jQAhLy/zIpEno9WyUD78SH3OfjJvX0n7zdWj5GPMcIp3U 3wHhixeevb4ReCUtsv5km6YftubmXUgw03Kt4Zlc6UtMjGKOlINv0Y1lcaqM0r1wInej fDj3GUskpGp9sZotNcfZmliZSy5opRopNSwEdn4JB8Knc4i8ILDlaKzbRlJoZR5H9Nkd AcdQ== MIME-Version: 1.0 In-Reply-To: <1eb7cd76-ade3-4c34-8816-6eaa7201262e@googlegroups.com> References: <1eb7cd76-ade3-4c34-8816-6eaa7201262e@googlegroups.com> Date: Fri, 11 Jan 2013 23:25:24 +0100 Subject: Re: Problem with importing in Python From: Adnan Sadzak To: su29090 <129km09@gmail.com>, python-list Content-Type: multipart/alternative; boundary=047d7b66f5158e956704d30ac514 X-BeenThere: python-list@python.org X-Mailman-Version: 2.1.15 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: 143 NNTP-Posting-Host: 2001:888:2000:d::a6 X-Trace: 1357943131 news.xs4all.nl 6990 [2001:888:2000:d::a6]:46828 X-Complaints-To: abuse@xs4all.nl Xref: csiph.com comp.lang.python:36648 --047d7b66f5158e956704d30ac514 Content-Type: text/plain; charset=UTF-8 Python is case sensitive. Circle and circle is not same. /* sent from android */ On Jan 11, 2013 11:22 PM, "su29090" <129km09@gmail.com> wrote: > I'm trying to import a python file it keeps saying: > > ImportError: cannot import name Circle > > Here is the file I'm trying to import: > > Circle.py > > import math > > class circle: > #Construct a circle object > def __init__(self, radius = 1): > self.radius = radius > > def getPerimeter(self): > return 2 * self.radius * math.pi > > def getArea(self): > return self.radius * self.radius * math.pi > > def setRadius(self, radius): > self.radius = radius > > from Circle import Circle > > def main(): > #Create a circle with a radius 1 > circle1 = Circle() > print("The area of the circle of radius", > circle1.radius, "is" , circle1.getArea()) > > #Create a circle with a radius 25 > circle2 = Circle(25) > print("The area of the circle of radius", > circle2.radius, "is" , circle2.getArea()) > > #Create a circle with a radius 125 > circle3 = Circle(125) > print("The area of the circle of radius", > circle3.radius, "is" , circle3.getArea()) > > #Modify circle radius > circle2.radius = 100 # or Circle2.setRadius(100) > print("The area of the circle of radius", > circle2.radius, "is" , circle2.getArea()) > > main() # Call the main function > > How can I solve this problem? > > Thanks in advance. > > -- > http://mail.python.org/mailman/listinfo/python-list > --047d7b66f5158e956704d30ac514 Content-Type: text/html; charset=UTF-8 Content-Transfer-Encoding: quoted-printable

Python is case sensitive.
Circle and circle is not same.




/* sent from android */

On Jan 11, 2013 11:22 PM, "su29090" &l= t;129km09@gmail.com> wrote:
I'm trying to import a python file it keeps saying:

ImportError: cannot import name Circle

Here is the file I'm trying to import:

Circle.py

import math

class circle:
=C2=A0 =C2=A0 #Construct a circle object
=C2=A0 =C2=A0 def __init__(self, radius =3D 1):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.radius =3D radius

=C2=A0 =C2=A0 def getPerimeter(self):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return 2 * self.radius * math.pi

=C2=A0 =C2=A0 def getArea(self):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 return self.radius * self.radius * math.pi

=C2=A0 =C2=A0 def setRadius(self, radius):
=C2=A0 =C2=A0 =C2=A0 =C2=A0 self.radius =3D radius

from Circle import Circle

def main():
=C2=A0 =C2=A0 #Create a circle with a radius 1
=C2=A0 =C2=A0 circle1 =3D Circle()
=C2=A0 =C2=A0 print("The area of the circle of radius",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 circle1.radius, "is" , circle1= .getArea())

=C2=A0 =C2=A0 #Create a circle with a radius 25
=C2=A0 =C2=A0 circle2 =3D Circle(25)
=C2=A0 =C2=A0 print("The area of the circle of radius",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 circle2.radius, "is" , circle2= .getArea())

=C2=A0 =C2=A0 #Create a circle with a radius 125
=C2=A0 =C2=A0 circle3 =3D Circle(125)
=C2=A0 =C2=A0 print("The area of the circle of radius",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 circle3.radius, "is" , circle3= .getArea())

=C2=A0 =C2=A0 #Modify circle radius
=C2=A0 =C2=A0 circle2.radius =3D 100 # or Circle2.setRadius(100)
=C2=A0 =C2=A0 print("The area of the circle of radius",
=C2=A0 =C2=A0 =C2=A0 =C2=A0 =C2=A0 circle2.radius, "is" , circle2= .getArea())

=C2=A0 =C2=A0 main() # Call the main function

How can I solve this problem?

Thanks in advance.

--
http://mail.python.org/mailman/listinfo/python-list
--047d7b66f5158e956704d30ac514--