Closed Bug 563963 Opened 14 years ago Closed 13 years ago

Exception on initial setup

Categories

(Add-on SDK Graveyard :: General, defect, P3)

x86
macOS
defect

Tracking

(Not tracked)

RESOLVED DUPLICATE of bug 556562
Future

People

(Reporter: davida, Unassigned)

Details

I just hg pulled the jetpack-sdk, then did:

sleet:jetpack-sdk davida$ ls
README.txt	examples	python-lib
bin		packages	static-files
sleet:jetpack-sdk davida$ source bin/activate
Welcome to the Jetpack SDK. Run 'cfx docs' for assistance.
(jetpack-sdk)sleet:jetpack-sdk davida$ cfx testall
Testing all available packages: nsjetpack, test-harness, development-mode, jetpack-core.
/Users/davida/src/jetpack-sdk/python-lib/cuddlefish/__init__.py:484: DeprecationWarning: BaseException.message has been deprecated as of Python 2.6
  if e.message.startswith(MOZRUNNER_BIN_NOT_FOUND):
Traceback (most recent call last):
  File "/Users/davida/src/jetpack-sdk/bin/cfx", line 6, in <module>
    cuddlefish.run()
  File "/Users/davida/src/jetpack-sdk/python-lib/cuddlefish/__init__.py", line 260, in run
    test_all_packages(env_root, defaults=options.__dict__)
  File "/Users/davida/src/jetpack-sdk/python-lib/cuddlefish/__init__.py", line 188, in test_all_packages
    defaults=defaults)
  File "/Users/davida/src/jetpack-sdk/python-lib/cuddlefish/__init__.py", line 482, in run
    logfile=options.logfile)
  File "/Users/davida/src/jetpack-sdk/python-lib/cuddlefish/runner.py", line 284, in run_app
    preferences=preferences)
TypeError: __init__() got an unexpected keyword argument 'addons'
(jetpack-sdk)sleet:jetpack-sdk davida$
Atul just helped someone with this problem the other day. IIRC it was a conflicting webrunner install, but he'd know for sure so CCing.
Yep, this is unfortunately because the end-user already has an older version of mozrunner installed on their system in site-packages, and the one that comes with the SDK is put *after* the default site-packages on sys.path (because bin/activate adds the python-lib directory to the PYTHONPATH env var), so all our scripts (including cfx) are importing the wrong version.

Really annoying because I don't know of any way to tell Python to have the SDK's packages override anything in site-packages without going into more heavyweight solutions like munging sys.path at the beginning of every SDK script, renaming the SDK's mozrunner package name, making SDK users use PIP or virtualenv, etc.
The description of the problem in comment 2 seems off to me, as it looks like bin/activate prepends the SDK python-lib directory to PYTHONPATH, and PYTHONPATH seems like it should take precedence over site-packages.

At least that's what it sounds like from the documentation <http://docs.python.org/tutorial/modules.html#the-module-search-path>, and my experimentation seems to indicate that as well (unless I'm wrong about where site-packages is loaded):

myk@myk:/mnt/hgfs/myk/Projects/jetpack-sdk$ source bin/activate
Welcome to the Jetpack SDK. Run 'cfx docs' for assistance.

(jetpack-sdk)myk@myk:/mnt/hgfs/myk/Projects/jetpack-sdk$ env | grep PYTHONPATH
PYTHONPATH=/mnt/hgfs/myk/Projects/jetpack-sdk/python-lib:/home/myk/Projects/raindrop/server/python

(jetpack-sdk)myk@myk:/mnt/hgfs/myk/Projects/jetpack-sdk$ python
Python 2.6.4 (r264:75706, Dec  7 2009, 18:45:15) 
[GCC 4.4.1] on linux2
Type "help", "copyright", "credits" or "license" for more information.
>>> import sys
>>> sys.path
['',

    VVV delicious foods that are also high in cholesterol VVV
'/usr/local/lib/python2.6/dist-packages/paisley-0.1-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/simplejson-2.0.9-py2.6-linux-i686.egg',
'/usr/local/lib/python2.6/dist-packages/Skype4Py-0.9.28.7-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/python_twitter-0.6-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/CouchDB-0.6-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/httplib2-0.5.0-py2.6.egg',
'/usr/local/lib/python2.6/dist-packages/feedparser-4.1-py2.6.egg',

    VVV PYTHONPATH injections VVV
'/mnt/hgfs/myk/Projects/jetpack-sdk/python-lib',
'/home/myk/Projects/raindrop/server/python',

    VVV site-packages et. al. (right?) VVV
'/usr/lib/python2.6',

    VVV other stuff VVV
'/usr/lib/python2.6/plat-linux2', '/usr/lib/python2.6/lib-tk', '/usr/lib/python2.6/lib-old', '/usr/lib/python2.6/lib-dynload', '/usr/lib/python2.6/dist-packages', '/usr/lib/python2.6/dist-packages/PIL', '/usr/lib/python2.6/dist-packages/gst-0.10', '/usr/lib/pymodules/python2.6', '/usr/lib/python2.6/dist-packages/gtk-2.0', '/usr/lib/pymodules/python2.6/gtk-2.0', '/usr/local/lib/python2.6/dist-packages']
Oh, I see, thanks for clarifying this. I think the problem, then, is actually that mozrunner is being put in the "delicious foods that are also high in cholesterol" area rather than site-packages--I guess this is the 'dist-packages' section?  In any case, it seems like that's where mozrunner is put when one installs it via 'sudo easy_install mozrunner', which is the most common form of installation. I'm not sure why setuptools doesn't just put all that stuff in site-packages, and I'm not sure how to override the mozrunner that's installed there.
The Add-on SDK is no longer a Mozilla Labs experiment and has become a big enough project to warrant its own Bugzilla product, so the "Add-on SDK" product has been created for it, and I am moving its bugs to that product.

To filter bugmail related to this change, filter on the word "looptid".
Component: Jetpack SDK → General
Product: Mozilla Labs → Add-on SDK
QA Contact: jetpack-sdk → general
Clint: this might be a duplicate of that other bug on which I cc:ed you recently.  Any thoughts on how we might be able to deal with this?
Priority: -- → P3
Target Milestone: --- → Future
Status: NEW → RESOLVED
Closed: 13 years ago
Resolution: --- → DUPLICATE
You need to log in before you can comment on or make changes to this bug.