问题
These are the steps I took:
- install apache 2.2.x
- install TortoiseHg 0.7
- copy hgwebdir.cgi, hgweb.config to cgi-bin
- edit hgweb.config as appropriate
- unzip $blah\TortoiseHg\library.zip to unzip $blah\TortoiseHg\library
- sys.path.append("$blah\TortoiseHg\library") at the beginning of hgwebdir.cgi
- move $blah\TortoiseHg\templates to $blah\TortoiseHg\library\templates
(Edit: I forgot to add that all these steps are laid out here.)
When I run http://localhost/cgi-bin/hgwebdir.cgi/ I can see my repository. If I try browse that repository, I'm told "DLL load failed: The specified module could not be found.". The last line of the walkback says "c:\program files\apache group\apache\cgi-bin\mercurial\osutil.pyc in __load()".
I've read about people having problems with pywintypes25.dll; this lives in "c:\program files\tortoisehg" and is already in my PATH.
What DLL couldn't be found?
回答1:
you missed the c libs of mercurial
there are 3 ways to get out of this
- recent mercurial versions ship with pure python implementations you can find in mercurial/pure
- compile it yourself (im not exactly sure on the steps, on any unix this just works)
- grab win32 installer from the website
note that i didn't yet take a look at how those are build
(you need a distutils based install, not a py2exe based one)
回答2:
First thing: don't use TortoiseHg for this. Use the Mercurial installer instead.
(TortoiseHg tries to be as independent of your Python installation as possible, and for reasons unclear to this Python-newbie, things Don't Work. Something about py2exe.)
Otherwise, just follow the steps in the HgWebDirStepByStep. I did have to install pywintypes, but YMMV. Lastly, the unzip utility mentioned on that page may do strange things with file permissions: I had to add read permissions to Templates directory and its files/subdirectories.
As an aside, if you're wondering how to set the style, add this to hgweb.config:
[web]
style = foo
回答3:
My setup involves an apache 2.2.17, mod_wsgi 3.3, python 2.7.2, trac 0.12.2, mercurial 1.8.4. Two issues surfaced:
- mercurial demandimport initialization order
- mercurial unable to load DLLs in site-packages.
I solved the problem as follows:
- change hgwebdir.wsgi to disable demandimport:
from mercurial import demandimport; demandimport.disable()
- create a pure (.py only, no compiled .pyd) mercurial package and install. See also https://www.mercurial-scm.org/wiki/WindowsInstall
E:\Dist\mercurial-1.8.4>setup.py --pure build
E:\Dist\mercurial-1.8.4>setup.py --pure install
The compiled versions (with Microsoft Visual Studio 2008) fail to load the DLL:
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] mod_wsgi (pid=6092): Exception occurred processing WSGI script 'D:/Home/web/apache/cgi-bin/hgwebdir.wsgi'.
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] Traceback (most recent call last):
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "D:/Home/web/apache/cgi-bin/hgwebdir.wsgi", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial.hgweb.hgwebdir_mod import hgwebdir
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\__init__.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import hgweb_mod, hgwebdir_mod
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\hgweb\\hgweb_mod.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] from mercurial import ui, hg, hook, error, encoding, templater
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\ui.py", line 10, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import config, util, error
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\config.py", line 9, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, util
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] File "C:\\Apps\\Python27\\lib\\site-packages\\mercurial\\util.py", line 17, in <module>
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] import error, osutil, encoding
[Thu Jun 16 21:46:28 2011] [error] [client 192.168.178.24] ImportError: DLL load failed: The specified module could not be found.
回答4:
I know this question is already answered, but I experienced a slightly different issue and found a work around --
I'm sure I'm missing something obvious in the Python configuration (2.5.4), but I'm having issues with .pyd versus .dll. (I had the same issues with the Python subversion libraries.) I see osutil.pyd in Mercurial\library.zip, but it fails to load it. Therefore, I unzipped library.zip and then copied *.pyd to *.dll, e.g:
REM Ugly DOS... Recursively renames all .pyd files to .dll
for /f "tokens=*" %%a in ('dir /s /b *.pyd') do copy "%%a" "%%~da%%~pa%%~na.dll"
Make sure the unzipped library directory is in the PYTHONPATH, but after this I successfully can execute: from mercurial import osutil. Also remember to copy or move the Templates directory to the newly unzipped library directory.
Follow the steps in Section 5 of the HgWebDirStepByStep for the rest. I did not experience the "Gotchas" in Section 5.3 though.
回答5:
For anyone looking for a step by step tutorial to use TortoiseHg and Apache on Windows, I've written one here: http://makinggames.ca/dev/version-control-mercurial-apache-tortoisehg/
来源:https://stackoverflow.com/questions/644322/how-do-i-get-mercurials-hgwebdir-working-on-windows