Closed Bug 558505 Opened 14 years ago Closed 14 years ago

command line error attempting to run "cfx docs" on windows

Categories

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

x86_64
Windows 7
defect
Not set
normal

Tracking

(Not tracked)

RESOLVED FIXED

People

(Reporter: fiveinchpixie, Assigned: mossop)

Details

Attachments

(1 file, 1 obsolete file)

User-Agent:       Mozilla/5.0 (Macintosh; U; Intel Mac OS X 10.5; en-US; rv:1.9.2.3) Gecko/20100401 Firefox/3.6.3
Build Identifier: jetpack-sdk 0.2rc2

'python' not found when trying to run cfx docs on windows via the command line.

Reproducible: Always

Steps to Reproduce:
1. installed python26 from binary on windows 7
2. installed Python for Extensions
3. downloaded jetpack-sdk-0.2 from the website
4. ran "bin\activate"
5. attempted to run cfx docs
Actual Results:  
'python' is not recognized as an internal or external command, operable program or batch file

Expected Results:  
start server; open Firefox to sdk documentation

I modified the cfx.bat file to read:

-----
@echo off

start python %VIRTUAL_ENV%\bin\cfx %1 %2 %3 %4 %5 %6 %7 %8 %9
-----

Which seemed to make it work fine. ('start' is also missing from the mozrunner.bat and the quick-start.bat files) I don't know if this is a windows 7 specific problem.

found while investigating this thread from google groups:
http://groups.google.com/group/mozilla-labs-jetpack/browse_thread/thread/9da22fd76b5c4c7e?hl=en
Whoa, that's cool that 'start' fixes this. I did not know about this command, is it documented somewhere? Also, does cfx's output display to the console when run in this way?

Thanks for looking into this!
Status: UNCONFIRMED → NEW
Ever confirmed: true
After verifying the console output, I have identified that this is actually partially user error. I had mistyped the folder name when adding python to my %PATH% variable. However, I think that there could be more information/clarity added to the documentation.

* verify that python is in the path correctly
* modify the "if on windows" to read "bin\activate" (use backslash instead of slash)

I could take it on to update the "installation" section.
|start| doesn't quite do what we need, since it runs python in a new window that closes when the process exits (taking all the console output with it).

(In reply to comment #2)
> After verifying the console output, I have identified that this is actually
> partially user error. I had mistyped the folder name when adding python to my
> %PATH% variable. However, I think that there could be more information/clarity
> added to the documentation.
> 
> * verify that python is in the path correctly

Yup, documentation of this would be good.  However, let's go one step further and have cfx.bat look for C:\Python2(5|6)\python.exe if a python executable isn't in the path, so users don't have to add python to the path at all if they have installed a supported version of Python in the default location.
Assignee: nobody → dtownsend
Attached patch patch rev 1 (obsolete) — Splinter Review
I hates me batch files but this seems to work. Assuming python was installed normally it will have put its path into the windows registry. This detects pythong 2.4, 2.5 or 2.6 (Preferring the newer version) and adds its install path to the end of PATH. This means any python already in PATH will be used in preference.
Attachment #443388 - Flags: review?(avarma)
Comment on attachment 443388 [details] [diff] [review]
patch rev 1

Awesome, thanks!

Erm, the only thing, though, is that it appears like you might be overloading the PYTHONPATH environment variable already being set by activate.bat, which is used internally by Python to add extra package directories to sys.path?

I'm also wondering if instead of adding this stuff to cfx.bat--which we'd then have to reduplicate for any other Python-based scripts like mozrunner.bat--we might instead want to add this code to activate.bat, so that all .bat files can remain the same and even the end-user can just type 'python' to run python code if they need to.

I think you're crazy busy with the Addon Manager rewrite issues, though... I would volunteer to make these changes for you, but unfortunately because my computer with the windows VM got tea'd, I don't currently have access to one that I can test the code on...
Attachment #443388 - Flags: review?(avarma) → review-
Attached patch patch rev 2Splinter Review
That's what I get for going quickly. Moved to activate.bat and changed the variable used. Verified that this works on my windows machine which doesn't have python in its path.
Attachment #443388 - Attachment is obsolete: true
Attachment #445383 - Flags: review?(avarma)
Comment on attachment 445383 [details] [diff] [review]
patch rev 2

Awesome!! Thanks for the patch, mossop. Can you go ahead and push this to the repo?
Attachment #445383 - Flags: review?(avarma) → review+
Landed: http://hg.mozilla.org/labs/jetpack-sdk/rev/3707d076c1c9
Status: NEW → RESOLVED
Closed: 14 years ago
Resolution: --- → FIXED
Target Milestone: -- → 0.4
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
Version: 0.2 → unspecified
You need to log in before you can comment on or make changes to this bug.

Attachment

General

Created:
Updated:
Size: