Hgweb.cgi Error Under IIS: No module named osutil

Jensen, Aaron ajensen at webmd.net
Thu Mar 8 16:48:28 CST 2012


I'm trying to get hgweb.cgi working under IIS 7.5 on Windows 7.  I've got python correctly configured as an HTTP handler responding to *.cgi web requests.  I'm now trying to get hgweb.cgi to work.

I have TortoiseHg 2.3.1 (64-bit) and Python 2.6.6 (64-bit) installed.

My webroot is at C:\HgWeb.  I copied the contents of the library.zip file that came with TortoiseHg into C:\HgWeb\lib.    The hgweb.cgi script is in my website root.  (I grabbed it from the 2.1.1 tag in the Mercurial source repository).  It looks like this:

     #!/usr/bin/env python
     config = "C:\HgWeb\hgweb.config"

     import sys; sys.path.insert(0, 'C: \HgWeb\lib')

     import cgitb; cgitb.enable()

     from mercurial import demandimport; demandimport.enable()
     from mercurial.hgweb import hgweb, wsgicgi
     application = hgweb(config)
     wsgicgi.launch(application)

My hgweb.config file is empty.

When I visit http://localhost/hgweb.cgi, I get the error "ImportError: No module named osutil" [1].

It seems I'm missing the osutil module.  I did a Google search, but couldn't find anything to download.  I found an issue where someone was seeing this error using the hg command line client on Ubuntu.  Someone asked a similar question on Stack Overflow, and one of the answers says that hgweb.cgi no longer works with Mercurial after 1.7.1.  Is that true?  If not, what can I do to get hgweb working?

     <:> Aaron


[1] Here's the full stack trace:
Traceback (most recent call last):
  File "C:\HgWeb\hgweb.cgi", line 19, in <module>
    application = hgweb(config)
  File "C:\HgWeb\lib\mercurial\hgweb\__init__.py", line 26, in hgweb
    return hgwebdir_mod.hgwebdir(config, baseui=baseui)
  File "C:\HgWeb\lib\mercurial\hgweb\hgwebdir_mod.py", line 89, in __init__
    self.refresh()
  File "C:\HgWeb\lib\mercurial\hgweb\hgwebdir_mod.py", line 98, in refresh
    u = ui.ui()
  File "C:\HgWeb\lib\mercurial\ui.py", line 43, in __init__
    for f in scmutil.rcpath():
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\HgWeb\lib\mercurial\scmutil.py", line 183, in <module>
    class opener(abstractopener):
  File "C:\HgWeb\lib\mercurial\scmutil.py", line 199, in opener
    @util.propertycache
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\HgWeb\lib\mercurial\util.py", line 27, in <module>
    platform.encodinglower = encoding.lower
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 89, in __setattr__
    self._load()
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
  File "C:\HgWeb\lib\mercurial\windows.py", line 37, in <module>
    posixfile.__doc__ = osutil.posixfile.__doc__
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 86, in __getattribute__
    self._load()
  File "C:\HgWeb\lib\mercurial\demandimport.py", line 58, in _load
    mod = _origimport(head, globals, locals)
ImportError: No module named osutil



More information about the Mercurial mailing list