> 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
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
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
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
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
/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
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:
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
>
> =
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
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
10 matches
Mail list logo