> 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
OK, so the problem was that I had to exit ipython, re-enter it, and then
import my module to get the errors to disappear. Thanks for the help!
(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.)
Th
Nick Matzke schrieb:
Scott David Daniels wrote:
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 o
Scott David Daniels wrote:
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:
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:
On 2009-02-05 10:08, 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)))
>
> dim
>>2
> ===
>
>
> But if I move these commands to a function in another file, it freaks out:
You n
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