Ask Your Question
0

Cython: undeclared name not builtin

asked 2020-01-03 17:32:28 +0200

Bob67846 gravatar image

Loading a .spyx file with

 def bla(W):
    RootSystem(W.cartan_type())

yields

undeclared name not builtin: RootSystem

Is there a library that I need to include?

edit retag flag offensive close merge delete

1 Answer

Sort by ยป oldest newest most voted
2

answered 2020-01-03 20:11:49 +0200

nbruin gravatar image

updated 2020-01-04 23:28:30 +0200

It looks like you should:

sage: import_statements(RootSystem)
from sage.combinat.root_system.root_system import RootSystem

As you can see in the documentation of import_statements, it tries to find out from where the symbol requested should be imported and returns a string that describes a command to do that import. So, in your case, it suggests to use

from sage.combinat.root_system.root_system import RootSystem
edit flag offensive delete link more

Comments

Thanks, this was helpful - the right answer is

from sage.all import RootSystem
Bob67846 gravatar imageBob67846 ( 2020-01-03 21:11:55 +0200 )edit
3

If you check the contents of sage.all, you'll see that it consists entirely of imports from other modules. There is something to say for importing symbols from their original location, which is why import_statements traces the import to its actual origin. I wouldn't say the import from sage.all is wrong but it's definitely not the right answer.

nbruin gravatar imagenbruin ( 2020-01-04 04:42:34 +0200 )edit

Sorry I'm new to this, but import_statements(RootSystem) didn't seem to work for Cython - I suppose the "right" answer might then be

from sage.combinat.root_system.root_system import RootSystem
Bob67846 gravatar imageBob67846 ( 2020-01-04 22:15:51 +0200 )edit

... and that's exactly what you meant. Woops!

Bob67846 gravatar imageBob67846 ( 2020-01-05 02:20:41 +0200 )edit

Your Answer

Please start posting anonymously - your entry will be published after you log in or create a new account.

Add Answer

Question Tools

1 follower

Stats

Asked: 2020-01-03 17:32:28 +0200

Seen: 2,929 times

Last updated: Jan 04 '20