Menu

#35 Should 'Register distribution' add reqd dirs to path

v2.7.4.2
Started
nobody
None
Medium
Defect
2013-05-08
2013-04-02
Anonymous
No

Originally created by: wsu...@gmail.com

I'm using WinPython-2.7.3 on WinXP x86 machine and used the Control Panel to register it as the local python distribution. It did not however add anything to my PATH variable. That is, even though double-clicking a .py file launches it with python, typing 'python' at the command prompt produces 'unrecognized command' messages. (This means "start python script.py" doesn't work either.)

Is there a reason the PATH is untouched? I'd expect a portable distro to leave it alone except for the fact I registered it. If there is good reason to leave paths alone when registering, could a second option 'Add to PATH' be added to the Control Panel Advanced menu?

Just to note... I see that \scripts\env.bat adds the necessary folders to PATH before registering python but (at least in my case) they are not saved permanently.

Related

Wiki: ChangeLog_27
Wiki: ChangeLog_33

Discussion

  • Anonymous

    Anonymous - 2013-04-02

    Originally posted by: wsu...@gmail.com

    Also FWIW: several Windows releases (XP, Vista, Server 2008b) cannot handle nested environment variables [http://support.microsoft.com/kb/911089]. This became an issue when I defined %WINPYDIR% as the python install path, then created %WINPYPATH% with the proper folders (rel. to %WINPYDIR%) and tried adding %WINPYPATH% to %PATH%.

    Based on that headache, the most flexible and portable way to 'Register' with PATH would seem to be to add a new env var %WINPYDIR%->[python install dir], then add the req'd folders to %PATH% itself (rel. to %WINPYDIR% of course). [Which is basically what happens in env.bat]

     
  • Anonymous

    Anonymous - 2013-04-21

    Originally posted by: pierre.raybaut

    The registration do not add anything to environment variables because it shouldn't be necessary when using WinPython launchers (due to the fact that it's a *portable* application). As a consequence, running 'python.exe' in a standard command window won't work: it will only work from a WinPython command window. Only the WinPython command window (or scripts\env.bat, which is basically the same thing) will configure your system completely.

    What you suggest is of course doable but would require some coding tasks:
      * Registering WinPython:
        * Add %WINPYDIR% environment variable
        * Add required folders to %PATH% with paths relatives to %WINPYDIR%
      * Unregistering WinPython:
        * Remove %WINPYDIR% environment variable
        * Remove all folders containing %WINPYDIR% in %PATH%

    What do you think about it?

     
  • Anonymous

    Anonymous - 2013-04-22

    Originally posted by: wsu...@gmail.com

    I think you understand what I'm looking for. I appreciate it's a portable application but since the status bar help message for Advanced > Register distribution... says 'Register file extensions, icons, and context menu' it seems sensible to me to add it to the system path as well.

    As far as adding it to the path, I believe the PATH env. var needs to be modified through the registry in order to make it stick. It could be added to just a user's PATH or the system PATH by using HKEY_USER versus HKLM (I think). I don't know which is cleaner for the user:

    1) Add a PYDIR env. var pointing to the python distro within WinPython, then add the necessary paths to PATH with a PYDIR substitute or

    2) Add a WINPYPATH env. var with all the required paths hardcoded to the internal python distro and add this new env. var to the path

    It is necessary to restrict nesting to one level for compatibility with, for example, XP machines.

    I imagine the reverse procedure for unregistering might be a bit more tedious. There does not appear to be a way to unregister WinPython at all at the moment though. Option 2 above would be easier to clean up IMO, especially if the env. var name was specific to a particular WinPython version. Then multiple WinPythons could un/re-register without affecting one another by adding/removing their specific env. var from PATH.

    Since not all users may want WinPython on their PATH, perhaps there should be new menu items: Advanced > Add python to user path, Advanced > Add python to system path

     
  • Anonymous

    Anonymous - 2013-04-22

    Originally posted by: pierre.raybaut

    Option 2 sounds good to me too. Excellent suggestion.

    As for modifying the PATH environment variable in a persistent way, it may be done using the following code for example:
    https://code.google.com/p/spyderlib/source/browse/spyderlib/utils/environ.py#75

    I'll implement this feature in next release, as soon as I can.

    Labels: Milestone-v2.7.4.0
    Status: Accepted

     
  • Anonymous

    Anonymous - 2013-04-22

    Originally posted by: wsu...@gmail.com

    Thank you for accepting my suggestion. And for providing the example link too.

     
  • Anonymous

    Anonymous - 2013-05-01

    Originally posted by: pierre.raybaut

    (No comment was entered for this change.)

    Labels: -Milestone-v2.7.4.0 Milestone-v2.7.4.1

     
  • Anonymous

    Anonymous - 2013-05-01

    Originally posted by: pierre.raybaut

    Started with [r4c7a90c40f0a].

    Status: Started

     
  • Anonymous

    Anonymous - 2013-05-08

    Originally posted by: pierre.raybaut

    (No comment was entered for this change.)

    Labels: -Milestone-v2.7.4.1 Milestone-v2.7.4.2

     

    Last edit: Anonymous 2017-03-20

Log in to post a comment.

Want the latest updates on software, tech news, and AI?
Get latest updates about software, tech news, and AI from SourceForge directly in your inbox once a month.