Need help understanding module import errors

I am trying to use the sendgrid Python API as a module in web2py. After successful testing from the command line, I lowered it to the folder with my modules, but as soon as I try to import sendgrid into my controller file, I get:

File "applications/test/modules/sendgrid/__init__.py", line 4, in
<module>
    del sendgrid, message NameError: name 'sendgrid' is not defined

Looking at the file __init__.py, I noticed that they are doing * import at the module level, which I saw cause problems before, m not sure what the problem is.

sendgrid/__init__.py:

from sendgrid import *
from message import *

del sendgrid, message

__version__ = "0.1.0"
version_info = (0, 1, 0)

sendgrid api: https://github.com/sendgrid/sendgrid-python

+3
source share
1 answer

, pip easy_install ( virtualenv), PyPI, - PYTHONPATH.

sendgrid pip install sendgrid-python easy_install sendgrid-python, pip .

+4

All Articles