Velocity Reviews - Computer Hardware Reviews

Velocity Reviews > Newsgroups > Programming > Python > Not defined

Reply
Thread Tools

Not defined

 
 
Rob
Guest
Posts: n/a
 
      10-01-2005
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



 
Reply With Quote
 
 
 
 
Pekka Karjalainen
Guest
Posts: n/a
 
      10-01-2005
In article <RVq%e.15439$(E-Mail Removed)>, 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

 
Reply With Quote
 
 
 
 
Kent Johnson
Guest
Posts: n/a
 
      10-01-2005
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
 
Reply With Quote
 
Pekka Karjalainen
Guest
Posts: n/a
 
      10-01-2005
I looked around a bit and found the answer. At least the change I
recommend below worked for me.

In article <RVq%e.15439$(E-Mail Removed)>, 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

 
Reply With Quote
 
Rob
Guest
Posts: n/a
 
      10-01-2005
Thanks for the replies gives me something to chew on.

Regards Gramps


 
Reply With Quote
 
Richie Hindle
Guest
Posts: n/a
 
      10-03-2005

[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
http://www.velocityreviews.com/forums/(E-Mail Removed)
 
Reply With Quote
 
 
 
Reply

Thread Tools

Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off
Trackbacks are On
Pingbacks are On
Refbacks are Off


Similar Threads
Thread Thread Starter Forum Replies Last Post
Re: __STDC_IEC_559__ (defined or !defined ?) Keith Thompson C Programming 0 08-17-2010 04:36 PM
User-defined exception: "global name 'TestRunError' is not defined" jmike@alum.mit.edu Python 1 07-10-2008 12:37 PM
defined? for recursive function call v/s defined? for function call stack Alok Ruby 3 04-13-2006 11:53 AM
Using parenthesis with defined (#if defined(...)) Angel Tsankov C++ 1 04-05-2006 10:00 PM
#if (defined(__STDC__) && !defined(NO_PROTOTYPE)) || defined(__cplusplus) Oodini C Programming 1 09-27-2005 07:58 PM



Advertisments