Using in class
excellentingenuity opened this issue · 5 comments
I may be missing something but following your example of using untangle does not work inside of a class for example:
import untangle
Class foo:
def load(self):
xmldoc = untangle.parse('test.xml')
I have tried assigning it to a class variable but was unable to. Any help would be appreciated.
What exactly is the error message you get? You can use untangle inside classes, see the test case I just added.
Here is the error I am getting
NameError: global name 'untagle' is not defined
I imported untangle in my python file above the class definition as in my example above. Also, I have untangled installed via pip, I double checked that earlier.
Thanks
First of all: check the spelling, the error you posted above says "untagle", correct is: "untangle".
Then: after pip installing it, open a python interpreter and check that "import untangle" works. Do you have more than one python version installed? Which python version does pip correspond to?
Thanks, I can't believe I missed the spelling error.
No worries. I'm glad we sorted it out ;)