[Tutor] import of source code still not working

Jason Massey jason.massey at gmail.com
Mon Feb 20 18:19:35 CET 2006


The problem here is that you need to reference the factor30 namespace to get
to your functions:

Your calls to your functions would then look like:

factor30.factor(1000009)

&

factor30.factor0(1000009)


If you don't want to have to put the factor30 in front of all your function
names you can do this:

from factor30 import *

Which will put all of your functions into the global namespace.

Then you can call factor() & factor0()  as you would expect to.



On 2/20/06, Kermit Rose <kermit at polaris.net> wrote:
>
> IDLE 1.1.2
> >>> import factor30
> >>> factor(1000009)
>
> Traceback (most recent call last):
>   File "<pyshell#1>", line 1, in -toplevel-
>     factor(1000009)
> NameError: name 'factor' is not defined
> >>> factor0(1000009)
>
> Traceback (most recent call last):
>   File "<pyshell#2>", line 1, in -toplevel-
>     factor0(1000009)
> NameError: name 'factor0' is not defined
> >>>
>
> _______________________________________________
> Tutor maillist  -  Tutor at python.org
> http://mail.python.org/mailman/listinfo/tutor
>
-------------- next part --------------
An HTML attachment was scrubbed...
URL: http://mail.python.org/pipermail/tutor/attachments/20060220/6d152256/attachment.htm 


More information about the Tutor mailing list