thegooglecodearchive / editra-plugins

Automatically exported from code.google.com/p/editra-plugins
0 stars 1 forks source link

[projects] hg, OSX10.6 "no module named pkg_resources" #130

Open GoogleCodeExporter opened 9 years ago

GoogleCodeExporter commented 9 years ago
What Plugin does this relate to? What version of the Plugin?
This relates to Projects v1.5
(Editra 0.5.15, OSX 10.6, Mercurial 1.3 and 1.4)

What steps will reproduce the problem?
1. Install Projects plugin.
2. Add existing hg repository.
3. View repository.

What is the expected output? What do you see instead?
I expect this to work similar to my SVN repositories (list files with
status indicated and allow me to preform source control actions).

Instead I get an error message in the Editra-log shelf:
[12:51:24][projects][info]/tmp/hgTestProj /usr/local/bin/hg status -A . 
[12:51:24][projects][err] 'import site' failed; use -v for traceback
[12:51:24][projects][err] Traceback (most recent call last):
[12:51:24][projects][err]   File "/usr/local/bin/hg", line 4, in <module>
[12:51:24][projects][err]     import pkg_resources
[12:51:24][projects][err] ImportError: No module named pkg_resources

Please provide any additional information below.
I do have setuptools installed.  hg functions without issues under the
command line and when using "Murky" (an obj-c GUI).

I have verified that setuptools is installed for both python-2.5 and 2.6.

If I add -v to /usr/local/bin/hg, I get:

[12:59:40][projects][err] # installing zipimport hook
[12:59:40][projects][err] import zipimport # builtin
[12:59:40][projects][err] # installed zipimport hook
[12:59:40][projects][err] #
/Applications/Editra.app/Contents/Resources/site.pyc matches
/Applications/Editra.app/Contents/Resources/site.py
[12:59:40][projects][err] import site # precompiled from
/Applications/Editra.app/Contents/Resources/site.pyc
[12:59:40][projects][err] 'import site' failed; traceback:
[12:59:40][projects][err] Traceback (most recent call last):
[12:59:40][projects][err]   File
"/Applications/Editra.app/Contents/Resources/site.py", line 15, in <module>
[12:59:40][projects][err]     import os
[12:59:40][projects][err] ImportError: No module named os
[12:59:40][projects][err] Python 2.6.1 (r261:67515, Jul  7 2009, 23:51:51)
[12:59:40][projects][err] [GCC 4.2.1 (Apple Inc. build 5646)] on darwin
[12:59:40][projects][err] Type "help", "copyright", "credits" or "license"
for more information.
[12:59:40][projects][err] Traceback (most recent call last):
[12:59:40][projects][err]   File "/usr/local/bin/hg", line 4, in <module>
[12:59:40][projects][err]     import pkg_resources
[12:59:40][projects][err] ImportError: No module named pkg_resources
[12:59:40][projects][err] # clear __builtin__._
[12:59:40][projects][err] # clear sys.path
[12:59:40][projects][err] # clear sys.argv
[12:59:40][projects][err] # clear sys.ps1
[12:59:40][projects][err] # clear sys.ps2
[12:59:40][projects][err] # clear sys.exitfunc
[12:59:40][projects][err] # clear sys.exc_type
[12:59:40][projects][err] # clear sys.exc_value
[12:59:40][projects][err] # clear sys.exc_traceback
[12:59:40][projects][err] # clear sys.last_type
[12:59:40][projects][err] # clear sys.last_value
[12:59:40][projects][err] # clear sys.last_traceback
[12:59:40][projects][err] # clear sys.path_hooks
[12:59:40][projects][err] # clear sys.path_importer_cache
[12:59:40][projects][err] # clear sys.meta_path
[12:59:40][projects][err] # clear sys.flags
[12:59:40][projects][err] # clear sys.float_info
[12:59:40][projects][err] # restore sys.stdin
[12:59:40][projects][err] # restore sys.stdout
[12:59:40][projects][err] # restore sys.stderr
[12:59:40][projects][err] # cleanup __main__
[12:59:40][projects][err] # cleanup[1] zipimport
[12:59:40][projects][err] # cleanup[1] signal
[12:59:40][projects][err] # cleanup[1] exceptions
[12:59:40][projects][err] # cleanup[1] _warnings
[12:59:40][projects][err] # cleanup sys
[12:59:40][projects][err] # cleanup __builtin__
[12:59:40][projects][err] # cleanup ints: 3 unfreed ints
[12:59:40][projects][err] # cleanup floats

Original issue reported on code.google.com by Robert.K...@gmail.com on 19 Nov 2009 at 6:00

GoogleCodeExporter commented 9 years ago
Hi,

This error appears to be happening in Mercurial, my guess is an environment 
issue.
Does Mercurial (hg) work fine if you run it from the terminal?

1) How did you install Mercurial? Mercurial is written in Python so you may 
need to
install setuptools to the same python installation that you installed Mercurial 
for
on your computer.

2) If Mercurial works fine from your command line it may be a PATH issue as if 
your
using a Binary install of Editra (from the dmg file) it will not inherit any 
custom
environment settings from your ~/.profile. In the config dialog you can add
additional environmental variables if necessary.

Cody

Original comment by CodyPrec...@gmail.com on 19 Nov 2009 at 7:21

GoogleCodeExporter commented 9 years ago
Hi Cody,
  Mercurial is working just fine from terminal;  I use it daily.

  The error does happen in the Mercurial "hg" script.  I verified that setuptools is
installed for both versions of Python on my system (2.5 and 2.6).  I installed
Mercurial using easy_install.  I tried a 1.3 and 1.4 version with the same 
result.

  I have also tried manually setting /usr/local/bin/hg to use python2.6 and
python2.5, in both cases I get the same error.

  The other thing I have tried is writing a quick little bash wrapper around hg.  I
did get a different error:
[16:53:50][projects][err] run error: [Errno 8] Exec format error

I am not sure where that error originates from in the code.  My wrapper works 
fine
from a terminal.

Any ideas?

Robert

Original comment by Robert.K...@gmail.com on 19 Nov 2009 at 9:58

GoogleCodeExporter commented 9 years ago
Hi,

I will have to try it on my machine to see if I can reproduce, but the error is
happening when the projects plugin is trying to run hg. All it does is simply 
take
the command you gave it and do a shell execute of that command line using
subprocess.Popen.

The traceback shows that the error is happening in the execution of the hg 
script not
from within the projects/editra's process. I think I saw this once when I was 
testing
on windows.

You might want to check your environment from the terminal (env). To see if 
there are
any Python or HG specific environmental variables that are set. If they are you 
may
need to add them to your HG configuration in the Projects plugin.

Will chime in again when I get a chance to test this issue.

Thanks,

cody

Original comment by CodyPrec...@gmail.com on 19 Nov 2009 at 10:41

GoogleCodeExporter commented 9 years ago
Hi Cody,
  Thank you for the prompt replies, I really appreciate it.

  I did not see any environmental variables related to python or hg.  I'll try doing
some more experiments with this too.

  So far all of my testing of hg, it works properly.  I will put together a simple
python script to call hg and let you know how that goes.

Robert

Original comment by Robert.K...@gmail.com on 19 Nov 2009 at 11:19

GoogleCodeExporter commented 9 years ago
I tested calling hg from python using both os.popen and subprocess.Popen, both 
worked
just fine.

Original comment by Robert.K...@gmail.com on 19 Nov 2009 at 11:31

GoogleCodeExporter commented 9 years ago
Hi,

Yes because when you use a script it is getting the same environment as doing 
it from
the terminal.

You are using Editra.app right? This is running in its own contained 
environment. If
you download the Editra source package unzip it and run the Editra script in 
there I
bet that hg will work fine in the projects plugin. The issue is that the built 
app
has some odd affect on the calling environment.

Cody

Original comment by CodyPrec...@gmail.com on 19 Nov 2009 at 11:40

GoogleCodeExporter commented 9 years ago
I downloaded the source tarball, ran python2.5 Editra  (it does not like my
python2.6, it complains with errors about wx and 64 bit).  Editra itself runs 
fine,
but I get exactly the same errors.

Original comment by Robert.K...@gmail.com on 20 Nov 2009 at 12:03

GoogleCodeExporter commented 9 years ago
I just tested on my machine (OSX 10.5). I am using the Framework builds from
python.org no sure it makes a difference compaired to the apple provided one.

Using Mercurial 1.1.2:

1) From the console HG works fine in the projects plugin for me.

2) Using Editra.app I get some errors like the following:

[18:18:07][projects][info]/Users/codyprecord/Desktop/devel/test_hg
/Library/Frameworks/Python.framework/Versions/Current/bin/hg status -A .
[18:18:07][projects][err] Traceback (most recent call last):
[18:18:07][projects][err]   File
"/Library/Frameworks/Python.framework/Versions/Current/bin/hg", line 11, in 
<module>
[18:18:07][projects][err]     from mercurial import demandimport; 
demandimport.enable()
[18:18:07][projects][err] ImportError: No module named mercurial
[18:18:42][projects][info]/Users/codyprecord/Desktop/devel/test_hg 
/usr/local/bin/hg
status -A .
[18:18:42][projects][err] Traceback (most recent call last):
[18:18:42][projects][err]   File "/usr/local/bin/hg", line 11, in <module>
[18:18:42][projects][err]     from mercurial import demandimport; 
demandimport.enable()
[18:18:42][projects][err] ImportError: No module named mercurial

Using the latest Mercurial 1.4: I see some different results

1) From the console again it works without issue on my machine

2) With Editra.app

[18:22:13][projects][info]/Users/codyprecord/Desktop/devel/test_hg
/Library/Frameworks/Python.framework/Versions/2.5/bin/hg status -A .
[18:22:16][projects][err] Traceback (most recent call last):
[18:22:16][projects][err]   File
"/Library/Frameworks/Python.framework/Versions/2.5/bin/hg", line 4, in <module>
[18:22:16][projects][err]     import pkg_resources
[18:22:16][projects][err]   File "pkg_resources.pyo", line 2485, in <module>
[18:22:16][projects][err]   File "pkg_resources.pyo", line 591, in require
[18:22:16][projects][err]   File "pkg_resources.pyo", line 489, in resolve
[18:22:16][projects][err] pkg_resources.DistributionNotFound: mercurial==1.4

I am not sure if something else on 10.6 could be at issue, I am planning to 
start
updating to 10.6 so Editra can officially support it. There are some issues in 
the
current version of wxPython/wxWidgets with 10.6 due to some changes apple (i.e 
the
font dialog will not work in Editra on 10.6 currently and there are some errors 
with
some of the drawing api's used.) but after the next release of wx is out I will 
upgrade.

Cody

Original comment by CodyPrec...@gmail.com on 20 Nov 2009 at 12:29

GoogleCodeExporter commented 9 years ago
When I use 2.5 for Mercurial instead of 2.6, I get similar errors to those.

When I was trying to run Editra with the Apple bundled 2.6 I was getting errors 
from
wx.  The errors seemed to indicate that the issue had to do with python running 
in 64
bit mode by default.  I have not tried to see if simply running python in 32 
bit mode
let that run yet.

I wrote a shell script that wrapped the default hg python script.  I was 
curious if
somehow calling the hg script from within a python environment could be causing 
this?
 I am not familiar enough with how Editra sets up its environment to know.

Please let me know if there is anything I can do to help with this.  If you 
have some
ideas I would be happy to help investigate them.

Robert

Original comment by Robert.K...@gmail.com on 20 Nov 2009 at 5:00