Re: global name 'sqrt' is not defined

2009-02-09 Thread Rob
> 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 mat

Re: global name 'sqrt' is not defined

2009-02-05 Thread Robert Kern
On 2009-02-05 18:55, James Mills wrote: On Fri, Feb 6, 2009 at 10:48 AM, Nick Matzke wrote: (PS: Is there a way to force a complete reload of a module, without exiting ipython? Just doing the import command again doesn't seem to do it.) m = __import__("mymobile") reload(m) Or more straight

Re: global name 'sqrt' is not defined

2009-02-05 Thread James Mills
On Fri, Feb 6, 2009 at 10:48 AM, Nick Matzke wrote: > (PS: Is there a way to force a complete reload of a module, without exiting > ipython? Just doing the import command again doesn't seem to do it.) m = __import__("mymobile") reload(m) cheers James -- http://mail.python.org/mailman/listinfo/p

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
Traceback (most recent call last) /bioinformatics/phylocom/ in () /bioinformatics/phylocom/_scripts/LR_run_functions_v2.py in make_half_square_array(linear_version_of_square_array) 1548 from numpy import sqrt 1549 a = linear_version_of_squar

Re: global name 'sqrt' is not defined

2009-02-05 Thread Diez B. Roggisch
ost recent call last) /bioinformatics/phylocom/ in () /bioinformatics/phylocom/_scripts/LR_run_functions_v2.py in make_half_square_array(linear_version_of_square_array) 1548 from numpy import sqrt 1549 a = linear_version_of_square_array -> 1550 dim = int(sqrt(si

Re: global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
/bioinformatics/phylocom/ in () /bioinformatics/phylocom/_scripts/LR_run_functions_v2.py in make_half_square_array(linear_version_of_square_array) 1548 from numpy import sqrt 1549 a = linear_version_of_square_array -> 1550 dim = int(sqrt(size(a))) 1551 1552

Re: global name 'sqrt' is not defined

2009-02-05 Thread Scott David Daniels
M.-A. Lemburg wrote: On 2009-02-05 10:08, Nick Matzke wrote: ..., I can run this in the ipython shell just fine: a = ["12", "15", "16", "38.2"] dim = int(sqrt(size(a))) ...But if I move these commands to a function in another file, it freaks out: You need to add: from math import sqrt or:

Re: global name 'sqrt' is not defined

2009-02-05 Thread M.-A. Lemburg
y in > make_half_square_array(linear_version_of_square_array) > 1548 > 1549 a = linear_version_of_square_array > -> 1550 dim = int(sqrt(size(a))) >1551 >1552 > > NameError: global name 'sqrt' is not defined > > =

Re: global name 'sqrt' is not defined

2009-02-05 Thread Chris Rebert
On Thu, Feb 5, 2009 at 1:08 AM, Nick Matzke wrote: > Hi all, > > So, I can run this in the ipython shell just fine: > > === > a = ["12", "15", "16", "38.2"] > dim = int(sqrt(size(a))) sqrt() is not a builtin function, it's located in the 'math' module. You must have imported it at some po

global name 'sqrt' is not defined

2009-02-05 Thread Nick Matzke
bioinformatics/phylocom/ in () /bioinformatics/phylocom/_scripts/LR_run_functions_v2.py in make_half_square_array(linear_version_of_square_array) 1548 1549 a = linear_version_of_square_array -> 1550 dim = int(sqrt(size(a))) 1551 1552 NameError: global name 'sqrt&#