NameError after importing third party module using NTL

8 views
Skip to first unread message

sea21

unread,
Dec 1, 2013, 9:24:11 PM12/1/13
to sage-s...@googlegroups.com
Hi,

I want to write a third party module to generate random numbers. It contains a class that includes a method to generate random numbers. The method calls on the NTL library:

r = ntl.ZZ_random(2**512)

However, after I installed the module via:

sage --python GenRan.py install

and imported the module, I get a NameError:

sage: from GenRan import *
sage: genran = GenRan()
sage: genran()
NameError: global name 'ntl' is not defined

But when I attach the python file directly via:

sage: attach GenRan.py
sage: genran = GenRan()
sage: genran()
32094823048203948204890234

I get the random number I desire. May I know why this is so?

I am using Sage version 5.7 on Linux version 2.6. Any help is greatly appreciated. Thanks!

Reply all
Reply to author
Forward
0 new messages