global name 'Tag' is not defined

411 views
Skip to first unread message

David

unread,
Dec 5, 2012, 5:41:59 PM12/5/12
to csc-32...@googlegroups.com
I'm getting the error: "global name 'Tag' is not defined" in the function _index_document. What exactly is the line "if isinstance(tag, Tag)" supposed to be checking anyway? What should the prefix of the Tag object be? 

aya

unread,
Dec 5, 2012, 6:11:53 PM12/5/12
to csc-32...@googlegroups.com
I got the same error and fix it now.
the file does not work with beautiful soup 4, you need to install beautiful soup 3.
i think...

David

unread,
Dec 5, 2012, 6:40:08 PM12/5/12
to csc-32...@googlegroups.com
That was exactly the problem. Thanks!

Areag Osman

unread,
Dec 5, 2012, 6:46:27 PM12/5/12
to csc-32...@googlegroups.com
If you are using Beautiful Soup 4, you can work around the problem by doing ...

from bs4 import BeautifulSoup
from bs4 import Tag

Instead of reverting back to Beautiful Soup 3

David

unread,
Dec 5, 2012, 7:27:55 PM12/5/12
to csc-32...@googlegroups.com
Using bs4 I had used "from bs4 import * "

Should that not have imported Tag? I might just not understand python's import statements, but I had thought that * expanded to all possible imports 
Reply all
Reply to author
Forward
0 new messages