Question

Okay I am newer to python and have been researching this problem but I can't find anything like it so I am not sure what is going on.

I am creating a program that involves sage and it has a message cue. We have this set up on a development machine, so I know it works but I was wanting to set it up on my own computer so I could get a better understanding of how it all works and make it easier to develop for myself.

To start up sage, we run a script that calls sages main binary file and passes it an executable .py file. (./sage/sage ./sage_server.py) This creates an error in the sage_server.py file:

Traceback (most recent call last):
  File "./sage_server.py", line 23, in <module>
    from carrot.messaging import Publisher
ImportError: No module named carrot.messaging

But whenever I run that file just in the terminal (./sage_server) the import works fine and isn't until line 27 that there is an error when it tries to import something from sage.

Does anyone know what would cause the error when it is being called by something else? I am very lost as to what would be causing this.

Was it helpful?

Solution

Sage has its own python, separate from the system libraries. This "carrot" module, whatever it is, must be installed in whatever python ./sage_server.py uses, but not in Sage.

You should be able to use either

[your-sage] -sh

to start up a Sage shell and use easy_install, or you could get whatever carroty package you're using, find its setup.py file, and then run

[your-sage] -python setup.py install

where obviously your-sage is the path to your sage.

Things get a little trickier if the install process isn't setup.py-based.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top