global name 'sqrt' is not defined
Rob
remm1 at member.fsf.org
Mon Feb 9 12:10:18 EST 2009
> Any ideas? If I do something like "import math" in the subfunction,
> then the error changes to "global name 'math' is not defined".
Presumably ipython does an import so you need to import it yourself
something like:
from math import sqrt
at the top of your source file. I don't know why math would not be
defined, it's built in -- probably a scoping logic problem in your code.
Put the form/import statement at the top of your module file (as is
usually done), not inside a function or other block.
Rob
More information about the Python-list
mailing list