No module named jetpack_sdk_env

RESOLVED FIXED

Status

Add-on SDK
General
P3
normal
RESOLVED FIXED
7 years ago
4 years ago

People

(Reporter: arky, Assigned: KWierso)

Tracking

Firefox Tracking Flags

(Not tracked)

Details

Attachments

(1 attachment)

(Reporter)

Description

7 years ago
User Agent: Mozilla/5.0 (X11; Linux i686; rv:7.0a1) Gecko/20110613 Firefox/7.0a1
Build ID: 20110613233742

Steps to reproduce:

When you do 'source bin/activate' from a parent directory you will get this error. 

c$ source addon-sdk/bin/activate
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named jetpack_sdk_env

When you are in the root directory 'addon-sdk' it works. 
$ cd addon-sdk/

$ source bin/activate
Welcome to the Add-on SDK. Run 'cfx docs' for assistance.
Status: UNCONFIRMED → NEW
Ever confirmed: true
Priority: -- → P3
Target Milestone: --- → 1.1
(Assignee)

Comment 1

6 years ago
(Pushing all open bugs to the --- milestone for the new triage system)
Target Milestone: 1.1 → ---
(Assignee)

Comment 2

6 years ago
Created attachment 567655 [details]
Make activate.bat warn the user if activate script is not run from the SDK root.

The activate scripts set %VIRTUAL_ENV% (or $VIRTUAL_ENV) to the current directory, which fails, because the scripts then look in VIRTUAL_ENV/python-lib for the jetpack_sdk_env file.

I think I have a "fix" for the Windows activate.bat file. Not sure exactly how to copy the change over to the other activate scripts...

This pull request adds a warning in the activate.bat file when it can't locate the python-lib folder directly underneath %VIRTUAL_ENV%, and then jumps to the end of the script so no further code is run.
Assignee: nobody → kwierso
Attachment #567655 - Flags: review?(myk)
Comment on attachment 567655 [details]
Make activate.bat warn the user if activate script is not run from the SDK root.

Comments in the pull request.
Attachment #567655 - Flags: review?(myk) → review-
An even better fix would be to set the various paths correctly even if the user is not in the root directory, f.e. by setting VIRTUAL_ENV to the parent directory of the directory in which the activate script is located.

Note also that VIRTUAL_ENV is set twice (without being changed in between) in bin/activate, which seems redundant and is worth removing in the process, since you're making changes in that area of the code.
Such work has already been done by myself for our Mozmill environment. Feel free to take out some of our code for it. Our repository you can find here:

https://github.com/whimboo/mozmill-environment

Related files:
https://github.com/whimboo/mozmill-environment/blob/master/linux/templates/run.sh
https://github.com/whimboo/mozmill-environment/blob/master/linux/templates/bin/activate

Whereby run.sh is a wrapper script which can execute commands from within the environment without requiring to source the activate script.
Blocks: 840023
(Reporter)

Comment 6

4 years ago
Works for me on latest release (commit ad58ee0e01d0b7e00a5baa4717262fa35a9e2ecf)

$ source addon-sdk/bin/activate
Welcome to the Add-on SDK. Run 'cfx docs' for assistance.

$ source ~/src/addon-sdk/bin/activate
Welcome to the Add-on SDK. Run 'cfx docs' for assistance.
Status: NEW → RESOLVED
Last Resolved: 4 years ago
Resolution: --- → WORKSFORME
A brand new clone of addon-sdk gave me this:

lcrouch-14912:addon-sdk lcrouch$ pwd
/Users/lcrouch/code/mozilla/addon-sdk
* master
lcrouch-14912:addon-sdk lcrouch$ source bin/activate
Traceback (most recent call last):
  File "<string>", line 1, in <module>
ImportError: No module named jetpack_sdk_env
(addon-sdk
* master)lcrouch-14912:addon-sdk lcrouch$
Status: RESOLVED → REOPENED
Resolution: WORKSFORME → ---
note: Mac OS X 10.8.5 w/ python 2.7.3
Nevermind, I'm dumb. I have a local alias for pwd:

alias pwd="pwd && git branch 2> /dev/null"

So it was adding extra output to pwd and therefore VIRTUAL_ENV.
Status: REOPENED → RESOLVED
Last Resolved: 4 years ago4 years ago
Resolution: --- → FIXED
You need to log in before you can comment on or make changes to this bug.