#!/usr/bin/env python

"""View documentation with PyDoc."""

import os
import pydoc
import sys
import threading
import time

TOOL_DIR = os.path.dirname(os.path.abspath(__file__))
LIB_DIR  = os.path.join(TOOL_DIR, '..', 'lib')
sys.path.insert(0, LIB_DIR)

# For some reason the .pyc files need to be recreated.
for (root, dirs, files) in os.walk(LIB_DIR):
    os.chdir(root)
    for name in files:
        if name.endswith('.pyc'):
            os.remove(name)

from gaupol.base.util import wwwlib
threading.Thread(target=pydoc.gui).start()
time.sleep(1)
wwwlib.browse_url('http://localhost:7464/gaupol.html')
