Not defined

Discussion in 'Python' started by Rob, Oct 1, 2005.

  1. Rob

    Rob Guest

    When trying the basic tutorial for cgkit I always seem to get a not defined
    error as follows.

    Pythonwin GUI

    >>> from cgkit import *
    >>> Sphere()

    Traceback (most recent call last):
    File "<interactive input>", line 1, in ?
    NameError: name 'Sphere' is not defined
    >>> b=Box(name="Cube", pos=(1.5,2,0))

    Traceback (most recent call last):
    File "<interactive input>", line 1, in ?
    NameError: name 'Box' is not defined
    >>>


    I am useing ver 2.4

    A little help would be most appreciated.

    Forgive me please if this is not the proper place for this ? I am trying to
    keep an active brain :)

    Regards Gramps
    Rob, Oct 1, 2005
    #1
    1. Advertising

  2. In article <RVq%e.15439$>, Rob wrote:
    >Forgive me please if this is not the proper place for this ? I am trying to
    >keep an active brain :)


    Seems proper to me :)

    You can see what you've just imported by using the built-in
    dir() function. Here's an example from my PyWin window:

    >>> dir()

    ['__builtins__', '__doc__', '__name__', 'pywin']
    >>> from math import *
    >>> dir ()

    ['__builtins__', '__doc__', '__name__', 'acos', 'asin', 'atan', 'atan2',
    'ceil', 'cos', 'cosh', 'degrees', 'e', 'exp', 'fabs', 'floor', 'fmod',
    'frexp', 'hypot', 'ldexp', 'log', 'log10', 'modf', 'pi', 'pow', 'pywin',
    'radians', 'sin', 'sinh', 'sqrt', 'tan', 'tanh']
    >>>


    Note that the first time I use dir() it lists just four items. After from
    math import * it lists all the stuff I got from the math module in
    addition.

    How does your dir() look after the import statement?

    --
    Pekka Henrik Karjalainen
    Pekka Karjalainen, Oct 1, 2005
    #2
    1. Advertising

  3. Rob

    Kent Johnson Guest

    Rob wrote:
    > When trying the basic tutorial for cgkit I always seem to get a not defined
    > error as follows.
    >
    > Pythonwin GUI
    >
    >
    >>>>from cgkit import *
    >>>>Sphere()

    >
    > Traceback (most recent call last):
    > File "<interactive input>", line 1, in ?
    > NameError: name 'Sphere' is not defined


    Which version of cgkit are you using?

    Kent
    Kent Johnson, Oct 1, 2005
    #3
  4. I looked around a bit and found the answer. At least the change I
    recommend below worked for me.

    In article <RVq%e.15439$>, Rob wrote:
    >When trying the basic tutorial for cgkit I always seem to get a not defined
    >error as follows.
    >
    >Pythonwin GUI
    >
    >>>> from cgkit import *


    This is "from cgkit.all import *" in the tutorial here:

    http://cgkit.sourceforge.net/doc2/node6.html

    It seems the tutorial you are using is out of date vis-a-vis the version
    of cgkit you use.

    --
    Pekka Henrik Karjalainen
    Pekka Karjalainen, Oct 1, 2005
    #4
  5. Rob

    Rob Guest

    Thanks for the replies gives me something to chew on.

    Regards Gramps
    Rob, Oct 1, 2005
    #5
  6. [Rob]
    > >>> from cgkit import *
    > >>> Sphere()

    > Traceback (most recent call last):
    > File "<interactive input>", line 1, in ?
    > NameError: name 'Sphere' is not defined


    Do you have a file of your own called cgkit.py? You're probably importing
    that rather than the real thing. Try this:

    >>> import cgkit
    >>> print cgkit.__file__
    >>> dir(cgkit)


    --
    Richie Hindle
    Richie Hindle, Oct 3, 2005
    #6
    1. Advertising

Want to reply to this thread or ask your own question?

It takes just 2 minutes to sign up (and it's free!). Just click the sign up button to choose a username and then you can ask your own questions on the forum.
Similar Threads
  1. Oodini
    Replies:
    1
    Views:
    1,750
    Keith Thompson
    Sep 27, 2005
  2. Angel Tsankov
    Replies:
    1
    Views:
    852
    Victor Bazarov
    Apr 5, 2006
  3. Replies:
    1
    Views:
    481
    Sion Arrowsmith
    Jul 10, 2008
  4. Keith Thompson

    Re: __STDC_IEC_559__ (defined or !defined ?)

    Keith Thompson, Aug 17, 2010, in forum: C Programming
    Replies:
    0
    Views:
    429
    Keith Thompson
    Aug 17, 2010
  5. Alok
    Replies:
    3
    Views:
    237
Loading...

Share This Page