No way, here the error reported changing the code of sanitizier using "from .tokenizer import HTMLTokenizer from .constants import tokenTypes" but the error reported is:
Python 3.1.2 (r312:79149, Mar 21 2010, 00:41:52) [MSC v.1500 32 bit (Intel)] on win32 Type "help", "copyright", "credits" or "license" for more information. >>> from html5lib import sanitizer ['C:\\Python31\\lib\\site-packages\\html5lib\\treebuilders'] html5lib.treebuilders._base Traceback (most recent call last): File "<stdin>", line 1, in <module> File "C:\Python31\lib\site-packages\html5lib\sanitizer.py", line 5, in <module> from constants import tokenTypes ImportError: No module named constants >>> from html5lib import sanitizer >>> p = html5lib.HTMLParser(tokenizer=sanitizer.HTMLSanitizer) Traceback (most recent call last): File "<stdin>", line 1, in <module> NameError: name 'html5lib' is not defined while using "from .tokenizer import HTMLTokenizer" from the shell produces: Traceback (most recent call last): File "<stdin>", line 1, in <module> ValueError: Attempted relative import in non-package No idea why (I'm not familiar with the language). Btw this is really a great project, obviously mantaining two versions is difficult. Hope I could help. On 20 Set, 23:33, James Graham <ja...@hoppipolla.co.uk> wrote: > On Mon, 20 Sep 2010 12:13:54 -0700, Aaron DeVore <aaron.dev...@gmail.com> > wrote: > > > On Mon, Sep 20, 2010 at 11:31 AM, gervaz <ger...@gmail.com> wrote: > >> from tokenizer import HTMLTokenizer > >> ImportError: No module named tokenizer > > > Doesn't it need to be a relative import? The syntax is a proceeding > period: > > > from .tokenizer import HTMLTokenizer > > The python 3 port is way behind the python 2 branch. I would like to make > a working python 3 version, but I think realistically that requires a > strategy to automatically keep the two ports in sync. If we can develop > such a strategy then restarting work on the python 3 port becomes much more > appealing. -- You received this message because you are subscribed to the Google Groups "html5lib-discuss" group. To post to this group, send an email to html5lib-disc...@googlegroups.com. To unsubscribe from this group, send email to html5lib-discuss+unsubscr...@googlegroups.com. For more options, visit this group at http://groups.google.com/group/html5lib-discuss?hl=en-GB.