Mercurial error with subrepos on windows - windows

I have critial problem with Mercurial configured with subrepos. When I try to commit or make update I get following error:
hg commit -m "commit" --traceback
Traceback (most recent call last):
File "mercurial\dispatch.pyc", line 87, in _runcatch
File "mercurial\dispatch.pyc", line 679, in _dispatch
File "mercurial\dispatch.pyc", line 454, in runcommand
File "mercurial\dispatch.pyc", line 733, in _runcommand
File "mercurial\dispatch.pyc", line 687, in checkargs
File "mercurial\dispatch.pyc", line 676, in <lambda>
File "mercurial\util.pyc", line 385, in check
File "mercurial\commands.pyc", line 1092, in commit
File "mercurial\cmdutil.pyc", line 1189, in commit
File "mercurial\commands.pyc", line 1087, in commitfunc
File "mercurial\localrepo.pyc", line 955, in commit
File "mercurial\subrepo.pyc", line 847, in dirty
File "mercurial\subrepo.pyc", line 783, in _gitisbare
File "mercurial\subrepo.pyc", line 717, in _gitcommand
File "mercurial\subrepo.pyc", line 721, in _gitdir
File "mercurial\subrepo.pyc", line 737, in _gitnodir
File "subprocess.pyc", line 623, in __init__
File "subprocess.pyc", line 833, in _execute_child
WindowsError: [Error 2] The system cannot find the file specified
abort: The system cannot find the file specified
My .hgsub:
webdriver/vendor/webdriver = [svn]http://php-webdriver-bindings.googlecode.com/svn/trunk/trunk/phpwebdriver/
app/vendor/bundles/Knp/Bundle/ZendCacheBundle = [git]http://github.com/knplabs/KnpZendCacheBundle.git
app/vendor/Zend/Cache = [git]http://github.com/knplabs/zend-cache.git
app/vendor/Zend/Filter = [git]http://github.com/knplabs/zend-filter.git
I use Windows XP and Mercurial 1.9.2. I have svn and git added to PATH and it works good.
When I try to update my subrepos manually there is no problem, svn up and git pull works good.

If the Git for Windows (mysysgit) directory in your path is C:\Program Files (x86)\Git\cmd, try changing it to:
C:\Program Files (x86)\Git\bin
This will enable git to work with Mercurial.

To debug your path problem, you can use the following file
# qnddebug.py
import os
import sys
import subprocess
print os.environ['PATH']
print subprocess.call(['git', '--version'])
sys.exit(23)
and run it with hg --config extensions.foo=qnddebug.py. Then you see in the first line which path mercurial uses to find programs. The last line is error-code of the git call, and must be 0. Maybe there is the output of git --version in the line before the exit status, but this is a platform-specific detail.

Related

What are the equivalent windows steps to setting up a virtual environment for Cookiecutters on Pylons?

I am completing the Quick Tutorial for Pyramid which is written for a Linux system and I am using Windows, so I convert each command to a Windows equivalent.
In Tutorial Step: Quick Project Startup with Cookiecutters I run into the following issues:
Command written in the Tutorial: i.e. for linux
$VENV/bin/pip install cookiecutter
What I do in Windows:
I activate the virtual environment with:
c:\projects\quick_tutorial\env\Scripts\Activate
Then I use the Windows command:
(env) c:\projects\quick_tutorial\env\Scripts\pip install cookiecutter
Similarly, I then run the following command:
(env) c:\projects\quick_tutorial\env\Scripts\cookiecutter https://github.com/Pylons/pyramid-cookiecutter-starter
The above command places a new folder: cc_starter inside my "...env\Scripts" folder. I assume this doesn't make sense, so I move cc_starter into c:\projects\quick_tutorial.
At this point my directory looks like: My Director, which:
(1) doesn't contain a "bin" folder; and
(2) doesn't have the "cc_starter" folder inside the "env" folder. <-- I assume these are the 2 main differences between how this project with virtual environment should be structured differently between Linux and Windows
The Problem:
The final part of this tutorial step is to run:
$ env/bin/pserve development.ini --reload
^^ for Linux
My Windows equivalent:
(env) c:\projects\quick_tutorial\cc_starter\pserve development.ini --reload
This unfortunately returns the following Traceback (most recent call last):
File "C:\Python34\lib\runpy.py", line 170, in _run_module_as_main
"main", mod_spec) File "C:\Python34\lib\runpy.py", line 85, in
_run_code exec(code, run_globals) File "c:\projects\quick_tutorial\env\Scripts\pserve.exe__main__.py", line
9, in File
"C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 60,
in main return command.run() File
"C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 371,
in run global_conf=vars) File
"C:\Python34\Lib\site-packages\pyramid\scripts\pserve.py", line 406,
in loadapp return loadapp(app_spec, name=name,
relative_to=relative_to, **kw) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 247,
in loadapp return loadobj(APP, uri, name=name, **kw) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 271,
in loadobj global_conf=global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 296,
in loadcontext global_conf=global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 320,
in _loadconfig return loader.get_context(object_type, name,
global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 454,
in get_context section) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 476,
in _context_from_use object_type, name=use,
global_conf=global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 406,
in get_context global_conf=global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 296,
in loadcontext global_conf=global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 328,
in _loadegg return loader.get_context(object_type, name,
global_conf) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 620,
in get_context object_type, name=name) File
"C:\Python34\Lib\site-packages\paste\deploy\loadwsgi.py", line 640,
in find_egg_entry_point pkg_resources.require(self.spec) File
"C:\Python34\Lib\site-packages\pkg_resources.py", line 669, in
require needed = self.resolve(parse_requirements(requirements))
File "C:\Python34\Lib\site-packages\pkg_resources.py", line 572, in
resolve raise DistributionNotFound(req)
pkg_resources.DistributionNotFound: cc-starter
(sorry about the block of text, it was copied directly out of command prompt)
Questions:
Do I need to run the "Activate" command, as I have done, inside the Scripts folder?
Is env\Scripts folder the equivalent of env\bin in Linux ?
Am I meant to move the "cc_starter folder" out of quick_tutorial\env\Scripts and place into \quick_tutorial? (as I have done)
What do I need to do to avoid error when I load development.ini?
First there is a PR for installing cookiecutter on Windows 10 that has been tested (by me in a VM). See https://github.com/stevepiercy/cookiecutter/blob/99250649aa3f4ba77091a72fe5df42d7f59859e6/docs/installation.rst and ping the maintainers of cookiecutter to merge the PR https://github.com/audreyr/cookiecutter/pull/887
We don't recommend activate. See http://docs.pylonsproject.org/projects/pyramid/en/latest/narr/install.html#venv-bin-pip-vs-source-bin-activate
Instead use an environment variable set to the Path or invoke the command using the full path to the executable. See http://docs.pylonsproject.org/projects/pyramid/en/latest/quick_tutorial/requirements.html
Close enough. For Linux, substitute / for \.
You should not move any folders or files at this step.
See previous items. The last line in the stacktrace indicates that the cc-starter package could not be found, either because you relocated it or you jumped into activate, or both.
Found the problem! In the tutorial: Quick Project Startup with Cookiecutters, it wasn't clear that I had to complete the following commands myself:
# Change directory into your newly created project.
$ cd cc_starter
# Create a new virtual environment...
$ python3 -m venv env
# ...where we upgrade packaging tools...
$ env/bin/pip install --upgrade pip setuptools
# ...and into which we install our project.
$ env/bin/pip install -e .
After running these commands, I was able to successfully complete the tutorial. Thank you, Steve Piercy for your help.

Incorrect path to addons running odoo.py in Bitnami Odoo Stack that is correct in openerp-server.conf

I'm trying to run ~/ERP/bitnami-odoo/python/bin/python ~/ERP/bitnami-odoo/apps/odoo/bin/odoo.py help and now I am getting this error:
~/ERP/bitnami-odoo/python/lib/python2.7/site-packages/setuptools-20.9.0-py2.7.egg/pkg_resources/__init__.py:1268: UserWarning: ~/ERP/bitnami-odoo/.tmp is writable by group/others and vulnerable to attack when used with get_resource_filename. Consider a more secure location (set with .set_extraction_path or the PYTHON_EGG_CACHE environment variable).
Traceback (most recent call last):
File "~/ERP/bitnami-odoo/apps/odoo/bin/odoo.py", line 4, in <module>
__import__('pkg_resources').run_script('odoo==8.0.post20151126', 'odoo.py')
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 719, in run_script
File "build/bdist.linux-x86_64/egg/pkg_resources/__init__.py", line 1504, in run_script
File "~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/EGG-INFO/scripts/odoo.py", line 160, in <module>
main()
File "~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/EGG-INFO/scripts/odoo.py", line 157, in main
openerp.cli.main()
File "~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/cli/__init__.py", line 58, in main
for m in module.get_modules():
File "~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/module.py", line 351, in get_modules
plist.extend(listdir(ad))
File "~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/modules/module.py", line 346, in listdir
return map(clean, filter(is_really_module, os.listdir(dir)))
OSError: [Errno 2] No such file or directory: '~/ERP/odoo/openerp/addons'
This directory is not correct (obviously), but I can't find where it is defined. The full path should be ~/ERP/bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/openerp/addons and this error shows a wrong path without /bitnami-odoo/apps/odoo/lib/odoo-8.0.post20151126-py2.7.egg/
I've tried passing the path to openerp-server.conf ~/ERP/bitnami-odoo/python/bin/python ~/ERP/bitnami-odoo/apps/odoo/bin/odoo.py help -c ~/ERP/bitnami-odoo/apps/odoo/conf/openerp-server.conf, where the addons path is the correct, but the error continues. Is it a bitnami error? If it is not, Where do I can solve that.
Note: I use ~/ to not expose the whole path. ;-)
There is a default config file in ~/.openerp_server.rc.
you can use addons_path = to set addons file.

How to fix the error when using gitstats with git in windows

I'm learning how to use gitstats to create reports with git. So I downloaded and installed Git-1.8.1.2-preview20130201.exe , python-2.6.2.msi , gp463-win32-setup.exe(gnuplot) and cloned gitstats
from http://gitstats.com/. And I also add my git, python, gnuplot, gitstats to my PATH. Then I created a repository with "Git Bash" by myself named repo1. But when I input the command to create the
reporting about repo1, it output an error like this:
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\Dynamsoft220\Desktop>e:
E:\>cd Jeremy\Git\gitstats
E:\Jeremy\Git\gitstats>python gitstats e:\Jeremy\Git\repo1 e:\Jeremy\Git\report
[0.08100] >> gnuplot --version
Output path: e:\Jeremy\Git\report
Git path: e:\Jeremy\Git\repo1
Collecting data...
[0.12600] >> git shortlog -s HEAD | wc -l
[0.08300] >> git show-ref --tags
[0.18100] >> git rev-list --pretty=format:"%at %ai %aN <%aE>" HEAD | grep -v ^co
mmit
[0.09300] >> git rev-list --pretty=format:"%at %T" HEAD | grep -v ^commit
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
Traceback (most recent call last):
File "<string>", line 1, in <module>
File "D:\Python26\lib\multiprocessing\forking.py", line 341, in main
prepare(preparation_data)
File "D:\Python26\lib\multiprocessing\forking.py", line 450, in prepare
file, path_name, etc = imp.find_module(main_name, dirs)
ImportError: No module named gitstats
I really have no idea about how to fix this error. Actually I thought maybe it is because the software version is too late, but it seems not! It seems too simple to be discussed for most of people
TT, so I can't find a lot of article about it. Any suggestions will be appreciate! Thanks~
I was also having problems getting gitstats to run on Windows. This was tricky, because it looks like everything is working, but it just doesn't work!
Here are a few tweaks that helped me.
First, I made sure PYTHON_PATH was set correctly and added it to the path:
C:\> set PYTHON_PATH=C:\Python27;C:\Python27\Lib;C:\Python27\DLLs;C:\Python27\Lib\lib-tk
C:\> set PATH=%PATH%;%PYTHON_PATH%
Next, I added gitstats to the path, because, well, why not at this point:
C:\> set PATH=%PATH%;c:\projects\gitstats
Last, rename* gitstats to gitstats.py:
C:\> cd projects\gitstats
C:\> ren gitstats gitstats.py
* The rename was mentioned in the issue log on github, and solved by #danio there: https://github.com/hoxu/gitstats/issues/34
You must add the gitstat folder in the PYTHON_PATH.
See this answer for how to add the PYTHON_PATH in windows.
https://stackoverflow.com/a/3701730/1226582
Slightly more complete instructions for running gitstats in Windows:
Install Python2 from https://www.python.org/downloads/release/python-2718/ (it might be a good idea to not add it to your PATH to avoid messing up your other Python installation)
Install gnuplot from https://sourceforge.net/projects/gnuplot/files/latest/download (you can add it to path)
Now run in git bash:
If you haven't downloaded it yet: "install" gitstats
git clone git://github.com/hoxu/gitstats.git
cd gitstats
Now every time you want to run it, first add Python 2 to (the front of) your PATH temporarily so gitstats can use it:
PYTHON_PATH=/C/Python27:/C/Python27/Lib:/C/Python27/DLLs:/C/Python27/Lib/lib-tk
PATH=$PYTHON_PATH:$PATH:"/C/Program Files/gnuplot/bin"
python gitstats /C/path/to/repo/to/analyze /C/path/to/output/dir
Now open C:\path\to\output\dir\index.html in your browser

32bit Python on Win7-64bit, import errors

When I try to launch ipython qtconsole from anywhere except my Python install dir, I get import errors. It seems to only work if I RUN->cmd.exe; cd C:\Users\me\python\Python27; ipython qtconsole;.
Ive tried Batch files, but it still seems if I don't run it within the context of my install dir, it just doesnt work. Always ipython-script that seems to be complaining. Here is the output...(this was from inside ipython with CurrentWorkingDirectory as my Desktop)
In [2]: !ipython qtconsole
Traceback (most recent call last):
File "C:\Users\me\python\Python27\ipython-script.py", line 770, in <module
>
load_entry_point('ipython==0.12', 'console_scripts', 'ipython')()
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 402, in launch_new
_instance
File "<string>", line 2, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 302, in initialize
File "<string>", line 2, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\core\application.py", line 325, in initialize
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\terminal\ipapp.py", line 297, in parse_comm
and_line
File "<string>", line 2, in parse_command_line
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 413, in parse_command_l
ine
File "<string>", line 2, in initialize_subcommand
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 84, in catch_config_err
or
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\config\application.py", line 349, in initialize_subc
ommand
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\utils\importstring.py", line 40, in import_item
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\frontend\qt\console\qtconsoleapp.py", line 30, in <m
odule>
File "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin\lib\site-packages\ipy
thon-0.12-py2.7.egg\IPython\external\qt.py", line 42, in <module>
ImportError: Cannot import PySide >= 1.0.3 or PyQt4 >= 4.7
Like I said, it works perfectly fine from within my install dir, and I am 96% sure my ENV variables PATH,PYTHONPATH,PYTHONHOME are kosher. Ive gone from deleting them, to completely overloading them one directory at a time, with no change in results.
And I have made sure the Wow6432None Python entries exist (I tried not to pollute those).
Ipython is not the only module with errors like this (also with same solution), but this is definitely the most annoying (I can't launch qtconsole from Run Prompt!)
EDIT::I did dig up a start menu entry, and after changing the 'start in' property, I was able to launch qtconsole, but I still don't quite understand why this import is being performed relative to the current directory.
I believe it had to do with qtconsole dependencies living in locations not directly on my defined PATH, and I believe there were some conflicts in my modules search PATHS.
The easiest solution I found was to use the environment variable PYTHONPATH.
It has been a while since my original post, and several things have changed since then, but I believe the important factors were these:
-Be careful of 32bit python installed on 64bit windows.
-Utilize PYTHONPATH to include important sub-directories, such as '/install-dir/Lib' or any others.
If you still have trouble with your env variables, use absolute commands as a failsafe (wrap these up in a script that makes it easier to use),
C:\Users\johnny42\python\Python27\pythonw.exe
C:\Users\johnny42\python\Python27\ipython-script.py qtconsole
The above example should be on ONE LINE. Do not just copy and paste it.
I have Python 32 bit in my 64 bit Windows OS. Even I have a similar error "c:\cpd-svn\branches\qt-4.8\win32-12-01\install\bin". I do not know where is it being set. Can you please share your findings as to where Python is getting this path from? And which path it should be updated with?

pyinstaller error

D:\TDDOWNLOAD\WWW1\pyinstaller>python Makespec.py C:\Documents and Settings\Admi
nistrator\桌面\a.py
wrote D:\TDDOWNLOAD\WWW1\pyinstaller\Documents\Documents.spec
now run Build.py to build the executable
D:\TDDOWNLOAD\WWW1\pyinstaller>python Build.py D:\TDDOWNLOAD\WWW1\pyinstaller\Do
cuments\Documents.spec
Traceback (most recent call last):
File "Build.py", line 1158, in <module>
main(args[0], configfilename=opts.configfile)
File "Build.py", line 1146, in main
build(specfile)
File "Build.py", line 1109, in build
execfile(spec)
File "D:\TDDOWNLOAD\WWW1\pyinstaller\Documents\Documents.spec", line 3, in <mo
dule>
pathex=['D:\\TDDOWNLOAD\\WWW1\\pyinstaller'])
File "Build.py", line 232, in __init__
raise ValueError, "script '%s' not found" % script
ValueError: script 'C:\Documents' not found
D:\TDDOWNLOAD\WWW1\pyinstaller>
put quotes around the paths with spaces
python Makespec.py "C:\Documents and Settings\Admi nistrator\桌面\a.py"
use full dir
cd D:\TDDOWNLOAD\WWW1\pyinstaller
python Makespec.py D:\TDDOWNLOAD\WWW1\pyinstaller\ss\a.py
python Build.py D:\TDDOWNLOAD\WWW1\pyinstaller\a\a.spec
it's ok

Resources