luckyging3r
luckyging3r

Reputation: 3165

web2py python - ImportError cannot import name

I keep getting this error: <type 'exceptions.ImportError'> cannot import name get_cert_infos. I'm pretty sure I'm importing everything correctly. The file with the problem is participant.py and has:

from datetime import date

from widgets import SelectOrAdd, LabelSortedOptionsWidget, DynamicSelect, \
        AutocompleteReferenceWidget
from communication import handle_notification, send_email
from utility import create_temp_password, hash_password

from export import get_cert_infos, build_certificate

I have exports.py and the get_cert_infos and build_certificate methods do exist inside of there. I don't understand what the problem is.

I looked at several of the other posts on this and they all seem to be saying that this is most likely a circular import problem

I have export installed and updated export==0.1.2

ImportError: Cannot import name X

Upvotes: 0

Views: 1646

Answers (1)

Arturo
Arturo

Reputation: 171

Try double checking the spelling, I know it's dumb, but it happens.

if it's not that, try writing this method in export

def hello_world():
    print 'hello world'

then

import export

export.hello_world()

if that works, it may be something wrong with the method itself, if it doesn't I imagine that the name export is reserved and is causing conflicts (my code editor doesn't mark it as reserved tho).

is it necessary to import only those two methods? or could you import the whole module and use the needed methods as in the case of the hello_world? does that cause you troubles? if you delete get_cert_infos does build_certificate give you any troubles?

Upvotes: 1

Related Questions