so the idea here is: you give the windows shell a filename;
if it can't find it, it will see if it can find it in any of the PATHS; If it doesn't have an extension (on Linux/unix you would set the execute permissions, but windows does this by filename extensions), windows will see if it can find the name you gave it with any of the extensions that windows knows to be executable (in some order - for example, see what happens if you JUST type web2py ---- not sure if it will find web2py.py in your path, but if it does, great; also if it does, and you install web2py.exe, also somewhere in the path, I would bet that windows will pick web2py.exe before web2py.py). If you DID type an extension, windows sees if it knows how to run this executable (e.g. if it has an association, a way to "open" the file - the defaults that windows will do iteself are *.exe and *.bin files). When you give web2py.py as a parameter, you are no longer running by the rules of the windows command interpreter (e.g. CMD.exe), but by python.exe - which itself does not use PATH to find script parameters, nor PYTHONPATH (which is for "from" and "import"). Hopefully this makes sense now - all you need to do is think about what is running, what has control at what point, and what the methods / rules are for the current process in control (current process running). On Wed, Aug 26, 2009 at 4:16 PM, Yarko Tymciurak<[email protected]> wrote: > On Wed, Aug 26, 2009 at 4:10 PM, Yarko Tymciurak<[email protected]> wrote: >> On Wed, Aug 26, 2009 at 2:55 PM, ctalley<[email protected]> wrote: > > .... >>> >>> I can run web2py.py from the command prompt from any directory. >>> >> >> What this means is that you have assiciated *.py in wondows as a kind >> of executable to be run by python.exe (which is ok); this only works >> from any directory because you have added web2py.py to your windows >> path. >> > > If I remember correctly, windows python installers will make this > association for you - that is associate *.py files with python.exe (so > you probably don't remember doing this). > > ..... >> >> If you want to pass web2py.py as a parameter to python.exe from >> anywhere, you need to tell python where to find the web2py.py file to >> open it. >> >> For example, if you set a windows environment variable such as: >> >> WEB2PY_PATH >> >> then >> >> python %WEB2PY_PATH/web2py.py >> >> would work as you are expecting. > > you can try this, for example, to convince yourself: Let's say you > have web2py installed in C:\workspace\web2py\trunk > > if you type: > > python c:\workspace/web2py\trunk\wrb2py.py > > this should work from anywhere. > >> >> BTW - this is not specific to windows - the same is true, for example, >> on Linux, for each item I've pointed out. >> >> Regards, >> - Yarko >> >>> >>> >>> >> > --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "web2py-users" group. To post to this group, send email to [email protected] To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/web2py?hl=en -~----------~----~----~----~------~----~------~--~---

