Unable to get hgwebdir.cgi working on windows

Andrew Robinson andrew.rw.robinson at gmail.com
Thu Jun 19 01:07:29 CDT 2008


I am unfortunately trying to get hg web working on windows. I have
installed apache 2.2 and python2.5 from python.org.

I am getting this error when trying to view a repository:

<type 'exceptions.ImportError'>: No module named pywintypes
      args = ('No module named pywintypes',)
      message = 'No module named pywintypes'

Here is what I did:
install the 1.0 windows binaries
extracted libraries.zip to lib (c:\program files\mercurial\lib)
copied templates folder into the lib folder
recursively give Everyone read+execute access to the lib folder

Clone my hg repository from my linux desktop to my windows server box
using hg clone & ssh to cygwin (c:\cygwin\home\anrobins\hg\my-repo)

Imported this hg.conf in httpd.conf:
ScriptAliasMatch ^/hg(.*) c:/cygwin/home/anrobins/hg/hgwebdir.cgi$1
<Location /hg>
  Allow from all
  Options ExecCGI

  AuthType Digest
  AuthName "Mercurial repositories"
  AuthDigestProvider file
  AuthUserFile c:/cygwin/home/anrobins/hg/hgusers
  <LimitExcept GET>
    Require valid-user
  </LimitExcept>
</Location>

Touched "c:/cygwin/home/anrobins/hg/hgusers" (only need read only at the moment)

Added c:/cygwin/home/anrobins/hg/hgwebdir.cgi:
#!c:\python25\python.exe
import sys
sys.path.insert(0, 'c:/program files/mercurial/lib')

import cgitb
cgitb.enable()

import os
os.environ["HGENCODING"] = "UTF-8"

from mercurial.hgweb.hgwebdir_mod import hgwebdir
from mercurial.hgweb.request import wsgiapplication
import mercurial.hgweb.wsgicgi as wsgicgi

def make_web_app():
  return hgwebdir("hgweb.config")

wsgicgi.launch(wsgiapplication(make_web_app))


I then created hgweb.config:
[paths]
my-repo = my-repo

I see the my-repo at http://localhost/hg/, but I cannot view it do to
the above error

Full stack:
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\wsgicgi.pyc in
launch(application=<function run_wsgi at 0x00895230>)
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\request.pyc in
run_wsgi(env={'COMSPEC': r'C:\WINDOWS\system32\cmd.exe',
'DOCUMENT_ROOT': 'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs', 'GATEWAY_INTERFACE': 'CGI/1.1',
'HGENCODING': 'UTF-8', 'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'UTF-8,*', 'HTTP_ACCEPT_ENCODING':
'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.8,he;q=0.6,ar-sa;q=0.4,ko;q=0.2', 'HTTP_CACHE_CONTROL':
'max-age=0', 'HTTP_CONNECTION': 'keep-alive', ...}, respond=<function
start_response at 0x0090C5F0>)
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\hgwebdir_mod.pyc in
__call__(self=<mercurial.hgweb.hgwebdir_mod.hgwebdir object at
0x00891AB0>, env={'COMSPEC': r'C:\WINDOWS\system32\cmd.exe',
'DOCUMENT_ROOT': 'C:/Program Files/Apache Software
Foundation/Apache2.2/htdocs', 'GATEWAY_INTERFACE': 'CGI/1.1',
'HGENCODING': 'UTF-8', 'HTTP_ACCEPT':
'text/html,application/xhtml+xml,application/xml;q=0.9,*/*;q=0.8',
'HTTP_ACCEPT_CHARSET': 'UTF-8,*', 'HTTP_ACCEPT_ENCODING':
'gzip,deflate', 'HTTP_ACCEPT_LANGUAGE':
'en-us,en;q=0.8,he;q=0.6,ar-sa;q=0.4,ko;q=0.2', 'HTTP_CACHE_CONTROL':
'max-age=0', 'HTTP_CONNECTION': 'keep-alive', ...}, respond=<function
start_response at 0x0090C5F0>)
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\hgwebdir_mod.pyc in
run_wsgi(self=<mercurial.hgweb.hgwebdir_mod.hgwebdir object at
0x00891AB0>, req=<mercurial.hgweb.request.wsgirequest object at
0x00891A70>)
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\hgweb_mod.pyc in
run_wsgi(self=<mercurial.hgweb.hgweb_mod.hgweb object at 0x009F3990>,
req=<mercurial.hgweb.request.wsgirequest object at 0x00891A70>)
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\request.pyc in
write(self=<mercurial.hgweb.request.wsgirequest object at 0x00891A70>,
thing=<generator object at 0x00A32968>)
 C:\cygwin\home\anrobins\hg\mercurial\templater.pyc in
__call__(self=<mercurial.templater.templater object at 0x00A15350>,
t='shortlog', **map={'archives': <generator object at 0x00A32940>,
'changenav': <function nav at 0x00A38730>, 'changesets': 27,
'entries': <function <lambda> at 0x00A387B0>, 'latestentry': <function
<lambda> at 0x00A387F0>, 'node':
'ec597d05de40bbd764def35df8c41b255e01b409', 'rev': 26})
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\hgweb_mod.pyc in
changelist(limit=0, **map={'archives': <generator object at
0x00A32940>, 'changenav': <function nav at 0x00A38730>, 'changesets':
27, 'entries': <function <lambda> at 0x00A387B0>, 'latestentry':
<function <lambda> at 0x00A387F0>, 'node':
'ec597d05de40bbd764def35df8c41b255e01b409', 'rev': 26})
 C:\cygwin\home\anrobins\hg\mercurial\hgweb\hgweb_mod.pyc in
nodetagsdict(self=<mercurial.hgweb.hgweb_mod.hgweb object at
0x009F3990>, node='\xc8"\xad\xf0\xab\x8e\x1d\xcb,\x11\xc6\xf2\x079\xf5\xd2\xea\x10\x16q')
 C:\cygwin\home\anrobins\hg\mercurial\localrepo.pyc in
nodetags(self=<mercurial.localrepo.localrepository object at
0x00891370>, node='\xc8"\xad\xf0\xab\x8e\x1d\xcb,\x11\xc6\xf2\x079\xf5\xd2\xea\x10\x16q')
 C:\cygwin\home\anrobins\hg\mercurial\localrepo.pyc in
tags(self=<mercurial.localrepo.localrepository object at 0x00891370>)
 C:\cygwin\home\anrobins\hg\mercurial\util.pyc in
__call__(self=<mercurial.util.opener object at 0x00A07D70>,
path='localtags', mode='rb', text=False, atomictemp=False)
 C:\cygwin\home\anrobins\hg\mercurial\util_win32.pyc in
__init__(self=<mercurial.util_win32.posixfile_nt object at
0x00A39B70>, name=r'C:\cygwin\home\anrobins\hg\my-repo\.hg\localtags',
mode='rb')
 C:\cygwin\home\anrobins\hg\mercurial\demandimport.pyc in
__getattribute__(self=<unloaded module 'pywintypes'>, attr='error')
 C:\cygwin\home\anrobins\hg\mercurial\demandimport.pyc in
_load(self=<unloaded module 'pywintypes'>)


How do I get python to see pywintypes?

I see pywintypes25.dll in the lib directory, but apparently it isn't
in there or isn't being found or something.

Thanks,
Andrew


More information about the Mercurial mailing list