Reputation: 823
I'm trying to install TortoiseHg for Mac following these instructions : https://bitbucket.org/tortoisehg/thg/wiki/developers/MacOSX#!alternative-install-via-macports
I'm trying to follow the instructions about the "Alternative: Install via Homebrew" and I have an issue.
When I execute ./thg log
as in the instructions it works, TortoiseHg is launching. However when I try to create an App from the python script, the App is created but when I launch it it crashes.
Here is the output :
Traceback (most recent call last):
File "/Users/fabienhenon/Documents/thg-mac-app/dist/TortoiseHg.app/Contents/Resources/__boot__.py", line 316, in <module>
_run()
File "/Users/fabienhenon/Documents/thg-mac-app/dist/TortoiseHg.app/Contents/Resources/__boot__.py", line 311, in _run
exec(compile(source, path, 'exec'), globals(), globals())
File "/Users/fabienhenon/Documents/thg-mac-app/dist/TortoiseHg.app/Contents/Resources/main.py", line 28, in <module>
imp.load_source("thg", SCRIPT_DIR + "/bin/thg")
File "/Users/fabienhenon/Documents/thg-mac-app/dist/TortoiseHg.app/Contents/Resources/bin/thg", line 56, in <module>
from mercurial import demandimport
ImportError: No module named mercurial
2013-01-06 12:25:17.436 TortoiseHg[406:707] TortoiseHg Error
logout
[Opération terminée]
When I type : hg --version
I have the following output :
Mercurial Distributed SCM (version 2.4.2+20130102)
(see http://mercurial.selenic.com for more information)
Copyright (C) 2005-2012 Matt Mackall and others
This is free software; see the source for copying conditions. There is NO
warranty; not even for MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE.
Can somebody help me with this issue ?
Thank you for your answers
Upvotes: 2
Views: 3015
Reputation: 823
I've found a solution to solve this issue.
From the error message I had, the script could not find the module named mercurial. I'm new with Python so I had to make some researches to know how module importation works and I found something about dynamically importing a module using the 'sys'
module.
My solution was to edit the tortoisehg source code (the file where the error came from) to dynamically add the path to my mercurial module to the 'sys.path'
so that the program knows where to find the mercurial module.
Here is the code (in the 'thg' python file, line 56 (as mentioned by the error)) :
import sys
sys.path.append("/Library/Python/2.7/site-packages")
You have to add this code just before this line :
from mercurial import demandimport
And the path must correspond to the location of your mercurial folder.
Upvotes: 4