Mercurial CGI (hgweb.cgi) fails
Question: I have Mercurial 1.8.1, Python 2.6.6 installed on Win 2k8 R2 running on a vm.
I have tried installing from msi, source and using tortisehg. Command-line Hg
works fine but I get the same error when running the hgweb.cgi:

    
    
    Traceback (most recent call last):
      File ".\hgweb.cgi", line 17, in 
        application = hgweb(config)
      File "mercurial\hgweb\__init__.pyc", line 26, in hgweb
    
      File "mercurial\hgweb\hgwebdir_mod.pyc", line 61, in __init__
    
      File "mercurial\hgweb\hgwebdir_mod.pyc", line 70, in refresh
    
      File "mercurial\ui.pyc", line 35, in __init__
    
      File "mercurial\demandimport.pyc", line 75, in __getattribute__
    
      File "mercurial\demandimport.pyc", line 47, in _load
    
      File "mercurial\util.pyc", line 576, in 
    
      File "mercurial\demandimport.pyc", line 85, in _demandimport
    
      File "mercurial\windows.pyc", line 21, in 
    
      File "mercurial\demandimport.pyc", line 75, in __getattribute__
    
      File "mercurial\demandimport.pyc", line 47, in _load
    
      File "mercurial\osutil.pyc", line 12, in 
    
      File "mercurial\osutil.pyc", line 10, in __load
    
    ImportError: DLL load failed: The specified module could not be found.
    

The other answers I have found on SO and elsewhere pointed me to try
installing from source, dropping the pure osutil into the install, or
installing an older version. I have tried them all.

This is especially frustrating because I have other, similar non-vm machines
running fine but have been unable to find the disconnect.

Ideas?


Answer: I had the same error using following system configuration

  * Python-2.6.6 installed as msi
  * mercurial-1.8.2-x86 installed as msi
  * IIS7

I solved this problem simply:

  1. Python has been installed early
  2. Uninstall Mercurial msi package
  3. Download and install "Mercurial-1.8.2 (32-bit py2.6)" installer from [mercurial website](http://mercurial.selenic.com/wiki/Download#Windows "here") which is marked as "_This is recommended for hgweb setups_ ".
  4. copyed content of C:\Python26\Lib\site-packages\mercurial\ to the directory used in IIS7 website setup.

Till now all is working. Hope this will help.

