0

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

Community
  • 1
  • 1
luckyging3r
  • 3,047
  • 3
  • 18
  • 37

1 Answers1

1

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?

Arturo
  • 171
  • 1
  • 17
  • Thanks. It turns out it was the reserved word `export` causing conflicts. I was importing export and had a file called export.py... export was overwriting my export.py and therefore didn't have the methods I needed. I ran a `pip uninstall export` as I don't actually need it and it solved my problems. I'll have to rename that file to avoid future conflicts. – luckyging3r Aug 18 '16 at 20:13