System variable PATH overwritten in QGIS? The Next CEO of Stack OverflowHow can I create a...

Anatomically Correct Strange Women In Ponds Distributing Swords

Trouble understanding the speech of overseas colleagues

How do I construct this japanese bowl?

When airplanes disconnect from a tanker during air to air refueling, why do they bank so sharply to the right?

How can I quit an app using Terminal?

How to be diplomatic in refusing to write code that breaches the privacy of our users

Should I tutor a student who I know has cheated on their homework?

Is it my responsibility to learn a new technology in my own time my employer wants to implement?

How to start emacs in "nothing" mode (`fundamental-mode`)

Can a caster that cast Polymorph on themselves stop concentrating at any point even if their Int is low?

What does this shorthand mean?

Is there a good way to store credentials outside of a password manager?

Are there languages with no euphemisms?

How to write the block matrix in LaTex?

How to safely derail a train during transit?

Inappropriate reference requests from Journal reviewers

ls Ordering[Ordering[list]] optimal?

How easy is it to start Magic from scratch?

Is it a good idea to use COLUMN AS (left([Another_Column],(4)) instead of LEFT in the select?

What is the purpose of the Evocation wizard's Potent Cantrip feature?

Only print output after finding pattern

count occurances of text in file with bash

How can I open an app using Terminal?

Fastest way to shutdown Ubuntu Mate 18.10



System variable PATH overwritten in QGIS?



The Next CEO of Stack OverflowHow can I create a QGIS plugin that needs an external Python library?Call external programmes from python plugin in QGIS on windowsHow to link to external files with relative path in QGIS actions?How to use relative path in Mac for open internal and external file?Overriding the QGIS Feature DialogQGIS Server does not publish Oracle Spatial LayerQGIS - what is the core database system?QGIS docutils install (path,pythonpath,pythonhome)QGIS Oracle-Spatial-GeoRaster-Plugin not workingHow to force QGIS to use GDAL version?Remapping layers in QGIS project to other folders?How to use a relative path in QGIS 3.0 Processing Modeler?












3















The system env variable 'PATH' seems to be overwritten in Qgis, replacing it with their own values. Not sure if it was intended or not.



Anyway in version 2.2, I could solve it by go into settings and appending the PATH variable with the values copied from system properties => environment variables.



Apparently for version 2.4, the above solution does not work anymore and Qgis will always overwrite the PATH variable with their own values.



I needed the PATH variable as my project requires the execution of external programs from Qgis by making use of python subprocess module. Now in v2.4, external programs cannot be executed. I do not wish to define absolute path for all the external programs as the project will frequently be ported to different systems.










share|improve this question

























  • I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

    – user34545
    Jul 15 '14 at 8:53











  • The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

    – AndreJ
    Jul 15 '14 at 15:08











  • You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

    – underdark
    Jul 15 '14 at 16:19











  • Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

    – Nathan W
    Jul 15 '14 at 22:50
















3















The system env variable 'PATH' seems to be overwritten in Qgis, replacing it with their own values. Not sure if it was intended or not.



Anyway in version 2.2, I could solve it by go into settings and appending the PATH variable with the values copied from system properties => environment variables.



Apparently for version 2.4, the above solution does not work anymore and Qgis will always overwrite the PATH variable with their own values.



I needed the PATH variable as my project requires the execution of external programs from Qgis by making use of python subprocess module. Now in v2.4, external programs cannot be executed. I do not wish to define absolute path for all the external programs as the project will frequently be ported to different systems.










share|improve this question

























  • I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

    – user34545
    Jul 15 '14 at 8:53











  • The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

    – AndreJ
    Jul 15 '14 at 15:08











  • You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

    – underdark
    Jul 15 '14 at 16:19











  • Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

    – Nathan W
    Jul 15 '14 at 22:50














3












3








3


2






The system env variable 'PATH' seems to be overwritten in Qgis, replacing it with their own values. Not sure if it was intended or not.



Anyway in version 2.2, I could solve it by go into settings and appending the PATH variable with the values copied from system properties => environment variables.



Apparently for version 2.4, the above solution does not work anymore and Qgis will always overwrite the PATH variable with their own values.



I needed the PATH variable as my project requires the execution of external programs from Qgis by making use of python subprocess module. Now in v2.4, external programs cannot be executed. I do not wish to define absolute path for all the external programs as the project will frequently be ported to different systems.










share|improve this question
















The system env variable 'PATH' seems to be overwritten in Qgis, replacing it with their own values. Not sure if it was intended or not.



Anyway in version 2.2, I could solve it by go into settings and appending the PATH variable with the values copied from system properties => environment variables.



Apparently for version 2.4, the above solution does not work anymore and Qgis will always overwrite the PATH variable with their own values.



I needed the PATH variable as my project requires the execution of external programs from Qgis by making use of python subprocess module. Now in v2.4, external programs cannot be executed. I do not wish to define absolute path for all the external programs as the project will frequently be ported to different systems.







qgis qgis-2






share|improve this question















share|improve this question













share|improve this question




share|improve this question








edited 6 mins ago









PolyGeo

53.8k1781245




53.8k1781245










asked Jul 15 '14 at 7:34









Yi FanYi Fan

162




162













  • I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

    – user34545
    Jul 15 '14 at 8:53











  • The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

    – AndreJ
    Jul 15 '14 at 15:08











  • You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

    – underdark
    Jul 15 '14 at 16:19











  • Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

    – Nathan W
    Jul 15 '14 at 22:50



















  • I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

    – user34545
    Jul 15 '14 at 8:53











  • The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

    – AndreJ
    Jul 15 '14 at 15:08











  • You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

    – underdark
    Jul 15 '14 at 16:19











  • Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

    – Nathan W
    Jul 15 '14 at 22:50

















I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

– user34545
Jul 15 '14 at 8:53





I'm the thread starter. I'm sorry that I can't seem to upvote your answer nor comment on it, probably because I'm new. Anyway, when you mentioned about the ../QGIS Valmiera/bin/qgis.bat, I went on to investigate further. Seems like the culprit lies in ../QGIS Valmiera/bin/o4w_env.bat that was being invoked earlier instead, on the following line: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem As you can see, the path variable has been set without appending it with the rest. With the following change: > set path=%OSGEO4W_ROOT%bin;%WINDIR%system32;%WINDIR%;%WINDIR%WBem;

– user34545
Jul 15 '14 at 8:53













The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

– AndreJ
Jul 15 '14 at 15:08





The o4w_env.bat file remarks start with clean path, so I assume it was done intentionally.

– AndreJ
Jul 15 '14 at 15:08













You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

– underdark
Jul 15 '14 at 16:19





You need to log in with your account to be able to comment and vote. Since you commented as @user34545, that tells me you were not logged in at that time.

– underdark
Jul 15 '14 at 16:19













Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

– Nathan W
Jul 15 '14 at 22:50





Yes it's done intentionally to avoid dll conflicts with system dlls etc. Everything QGIS needs is inside the install folder so we use that as the base.

– Nathan W
Jul 15 '14 at 22:50










4 Answers
4






active

oldest

votes


















2














A little late, but beter than never :)



I ran into this problem recently. I was writing a QGIS Python plugin that had to call a matlab script. But the plugin had to run on different machines and I wouldn't always know where Matlab would be installed. The trick was to read the system Path variable from the registry instead of using os.



The which function below was adapted from https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python.
The getenv_system function was taken from http://win32com.goermezer.de/content/view/210/190/.



# This function is like the linux which command
def which(program):
import os
def is_exe(fpath):
return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
fpath, fname = os.path.split(program)
if fpath:
if is_exe(program):
return program
else:
#for path in os.environ["PATH"].split(os.pathsep):
for path in getenv_system("PATH").split(os.pathsep):
path = path.strip('"')
exe_file = os.path.join(path, program)
if is_exe(exe_file):
return exe_file
return None

# This function gets a system variable
# it was necessary to use this instead of os.environ["PATH"] because QGIS overwrites the path variable
# the win32 libraries appear not to be part of the standard python install, but they are included in the
# python version that comes with QGIS
def getenv_system(varname, default=''):
import os
import win32api
import win32con
v = default
try:
rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
try:
v = str(win32api.RegQueryValueEx(rkey, varname)[0])
v = win32api.ExpandEnvironmentStrings(v)
except:
pass
finally:
win32api.RegCloseKey(rkey)
return v

# find the path to the matlab executable. This is necessary because QGIS overwrites the path variable
matlab = which('matlab.exe')
errCode = subprocess.call([matlab, "-r", myMatlabScript, "-nosplash", "-nodesktop", "-wait"])


The cool thing about this solution too is that you don't actually change the environment variables, so you get the path to your external application while still preventing clashes.






share|improve this answer

































    1














    QGIS does not change the PATH variable permanently, it just adds its own folders to a default Windows path while it is running. This is done in ../QGIS Valmiera/bin/qgis.bat:



    path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.3lib;%PATH%


    For QGIS 2.4, the line reads:



    path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.4lib;%PATH%


    So no great changes.



    With that extended path, QGIS.exe will be started. After exiting the programme, the command window session opened by qgis.bat gets closed, and everything is back to normal.






    share|improve this answer

































      1














      I am adding a solution for Unix like systems (tested on MacOS X):
      If the system $PATH variable is overwritten and that you want to add some paths:




      • Go under Preferences / System / Environment

      • "Append" to "Path" the path to the directory (ensure to start the path with ':')

      • Restart QGis


      Append a directory to the PATH variable






      share|improve this answer































        0














        I just wanted to point out that Bruno von Paris answer actually works for Windows with a little tweaking in QGIS 3.2.1 (and probably others), simply replace the : in his picture with ;



        E.g.



        Under Settings -> Options -> System -> Environment, tick 'use custom variables' and enter the following.



        Apply = Append



        Variable = PATH



        Value = ;C:PutPathHere






        share|improve this answer
























          Your Answer








          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "79"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          autoActivateHeartbeat: false,
          convertImagesToLinks: false,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: null,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














          draft saved

          draft discarded


















          StackExchange.ready(
          function () {
          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f107204%2fsystem-variable-path-overwritten-in-qgis%23new-answer', 'question_page');
          }
          );

          Post as a guest















          Required, but never shown

























          4 Answers
          4






          active

          oldest

          votes








          4 Answers
          4






          active

          oldest

          votes









          active

          oldest

          votes






          active

          oldest

          votes









          2














          A little late, but beter than never :)



          I ran into this problem recently. I was writing a QGIS Python plugin that had to call a matlab script. But the plugin had to run on different machines and I wouldn't always know where Matlab would be installed. The trick was to read the system Path variable from the registry instead of using os.



          The which function below was adapted from https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python.
          The getenv_system function was taken from http://win32com.goermezer.de/content/view/210/190/.



          # This function is like the linux which command
          def which(program):
          import os
          def is_exe(fpath):
          return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
          fpath, fname = os.path.split(program)
          if fpath:
          if is_exe(program):
          return program
          else:
          #for path in os.environ["PATH"].split(os.pathsep):
          for path in getenv_system("PATH").split(os.pathsep):
          path = path.strip('"')
          exe_file = os.path.join(path, program)
          if is_exe(exe_file):
          return exe_file
          return None

          # This function gets a system variable
          # it was necessary to use this instead of os.environ["PATH"] because QGIS overwrites the path variable
          # the win32 libraries appear not to be part of the standard python install, but they are included in the
          # python version that comes with QGIS
          def getenv_system(varname, default=''):
          import os
          import win32api
          import win32con
          v = default
          try:
          rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
          try:
          v = str(win32api.RegQueryValueEx(rkey, varname)[0])
          v = win32api.ExpandEnvironmentStrings(v)
          except:
          pass
          finally:
          win32api.RegCloseKey(rkey)
          return v

          # find the path to the matlab executable. This is necessary because QGIS overwrites the path variable
          matlab = which('matlab.exe')
          errCode = subprocess.call([matlab, "-r", myMatlabScript, "-nosplash", "-nodesktop", "-wait"])


          The cool thing about this solution too is that you don't actually change the environment variables, so you get the path to your external application while still preventing clashes.






          share|improve this answer






























            2














            A little late, but beter than never :)



            I ran into this problem recently. I was writing a QGIS Python plugin that had to call a matlab script. But the plugin had to run on different machines and I wouldn't always know where Matlab would be installed. The trick was to read the system Path variable from the registry instead of using os.



            The which function below was adapted from https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python.
            The getenv_system function was taken from http://win32com.goermezer.de/content/view/210/190/.



            # This function is like the linux which command
            def which(program):
            import os
            def is_exe(fpath):
            return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
            fpath, fname = os.path.split(program)
            if fpath:
            if is_exe(program):
            return program
            else:
            #for path in os.environ["PATH"].split(os.pathsep):
            for path in getenv_system("PATH").split(os.pathsep):
            path = path.strip('"')
            exe_file = os.path.join(path, program)
            if is_exe(exe_file):
            return exe_file
            return None

            # This function gets a system variable
            # it was necessary to use this instead of os.environ["PATH"] because QGIS overwrites the path variable
            # the win32 libraries appear not to be part of the standard python install, but they are included in the
            # python version that comes with QGIS
            def getenv_system(varname, default=''):
            import os
            import win32api
            import win32con
            v = default
            try:
            rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
            try:
            v = str(win32api.RegQueryValueEx(rkey, varname)[0])
            v = win32api.ExpandEnvironmentStrings(v)
            except:
            pass
            finally:
            win32api.RegCloseKey(rkey)
            return v

            # find the path to the matlab executable. This is necessary because QGIS overwrites the path variable
            matlab = which('matlab.exe')
            errCode = subprocess.call([matlab, "-r", myMatlabScript, "-nosplash", "-nodesktop", "-wait"])


            The cool thing about this solution too is that you don't actually change the environment variables, so you get the path to your external application while still preventing clashes.






            share|improve this answer




























              2












              2








              2







              A little late, but beter than never :)



              I ran into this problem recently. I was writing a QGIS Python plugin that had to call a matlab script. But the plugin had to run on different machines and I wouldn't always know where Matlab would be installed. The trick was to read the system Path variable from the registry instead of using os.



              The which function below was adapted from https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python.
              The getenv_system function was taken from http://win32com.goermezer.de/content/view/210/190/.



              # This function is like the linux which command
              def which(program):
              import os
              def is_exe(fpath):
              return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
              fpath, fname = os.path.split(program)
              if fpath:
              if is_exe(program):
              return program
              else:
              #for path in os.environ["PATH"].split(os.pathsep):
              for path in getenv_system("PATH").split(os.pathsep):
              path = path.strip('"')
              exe_file = os.path.join(path, program)
              if is_exe(exe_file):
              return exe_file
              return None

              # This function gets a system variable
              # it was necessary to use this instead of os.environ["PATH"] because QGIS overwrites the path variable
              # the win32 libraries appear not to be part of the standard python install, but they are included in the
              # python version that comes with QGIS
              def getenv_system(varname, default=''):
              import os
              import win32api
              import win32con
              v = default
              try:
              rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
              try:
              v = str(win32api.RegQueryValueEx(rkey, varname)[0])
              v = win32api.ExpandEnvironmentStrings(v)
              except:
              pass
              finally:
              win32api.RegCloseKey(rkey)
              return v

              # find the path to the matlab executable. This is necessary because QGIS overwrites the path variable
              matlab = which('matlab.exe')
              errCode = subprocess.call([matlab, "-r", myMatlabScript, "-nosplash", "-nodesktop", "-wait"])


              The cool thing about this solution too is that you don't actually change the environment variables, so you get the path to your external application while still preventing clashes.






              share|improve this answer















              A little late, but beter than never :)



              I ran into this problem recently. I was writing a QGIS Python plugin that had to call a matlab script. But the plugin had to run on different machines and I wouldn't always know where Matlab would be installed. The trick was to read the system Path variable from the registry instead of using os.



              The which function below was adapted from https://stackoverflow.com/questions/377017/test-if-executable-exists-in-python.
              The getenv_system function was taken from http://win32com.goermezer.de/content/view/210/190/.



              # This function is like the linux which command
              def which(program):
              import os
              def is_exe(fpath):
              return os.path.isfile(fpath) and os.access(fpath, os.X_OK)
              fpath, fname = os.path.split(program)
              if fpath:
              if is_exe(program):
              return program
              else:
              #for path in os.environ["PATH"].split(os.pathsep):
              for path in getenv_system("PATH").split(os.pathsep):
              path = path.strip('"')
              exe_file = os.path.join(path, program)
              if is_exe(exe_file):
              return exe_file
              return None

              # This function gets a system variable
              # it was necessary to use this instead of os.environ["PATH"] because QGIS overwrites the path variable
              # the win32 libraries appear not to be part of the standard python install, but they are included in the
              # python version that comes with QGIS
              def getenv_system(varname, default=''):
              import os
              import win32api
              import win32con
              v = default
              try:
              rkey = win32api.RegOpenKey(win32con.HKEY_LOCAL_MACHINE, 'SYSTEM\CurrentControlSet\Control\Session Manager\Environment')
              try:
              v = str(win32api.RegQueryValueEx(rkey, varname)[0])
              v = win32api.ExpandEnvironmentStrings(v)
              except:
              pass
              finally:
              win32api.RegCloseKey(rkey)
              return v

              # find the path to the matlab executable. This is necessary because QGIS overwrites the path variable
              matlab = which('matlab.exe')
              errCode = subprocess.call([matlab, "-r", myMatlabScript, "-nosplash", "-nodesktop", "-wait"])


              The cool thing about this solution too is that you don't actually change the environment variables, so you get the path to your external application while still preventing clashes.







              share|improve this answer














              share|improve this answer



              share|improve this answer








              edited May 23 '17 at 12:39









              Community

              1




              1










              answered Jul 30 '15 at 18:41









              user55937user55937

              958615




              958615

























                  1














                  QGIS does not change the PATH variable permanently, it just adds its own folders to a default Windows path while it is running. This is done in ../QGIS Valmiera/bin/qgis.bat:



                  path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.3lib;%PATH%


                  For QGIS 2.4, the line reads:



                  path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.4lib;%PATH%


                  So no great changes.



                  With that extended path, QGIS.exe will be started. After exiting the programme, the command window session opened by qgis.bat gets closed, and everything is back to normal.






                  share|improve this answer






























                    1














                    QGIS does not change the PATH variable permanently, it just adds its own folders to a default Windows path while it is running. This is done in ../QGIS Valmiera/bin/qgis.bat:



                    path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.3lib;%PATH%


                    For QGIS 2.4, the line reads:



                    path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.4lib;%PATH%


                    So no great changes.



                    With that extended path, QGIS.exe will be started. After exiting the programme, the command window session opened by qgis.bat gets closed, and everything is back to normal.






                    share|improve this answer




























                      1












                      1








                      1







                      QGIS does not change the PATH variable permanently, it just adds its own folders to a default Windows path while it is running. This is done in ../QGIS Valmiera/bin/qgis.bat:



                      path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.3lib;%PATH%


                      For QGIS 2.4, the line reads:



                      path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.4lib;%PATH%


                      So no great changes.



                      With that extended path, QGIS.exe will be started. After exiting the programme, the command window session opened by qgis.bat gets closed, and everything is back to normal.






                      share|improve this answer















                      QGIS does not change the PATH variable permanently, it just adds its own folders to a default Windows path while it is running. This is done in ../QGIS Valmiera/bin/qgis.bat:



                      path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.3lib;%PATH%


                      For QGIS 2.4, the line reads:



                      path %OSGEO4W_ROOT%appsqgisbin;%OSGEO4W_ROOT%appsgrassgrass-6.4.4lib;%PATH%


                      So no great changes.



                      With that extended path, QGIS.exe will be started. After exiting the programme, the command window session opened by qgis.bat gets closed, and everything is back to normal.







                      share|improve this answer














                      share|improve this answer



                      share|improve this answer








                      edited Jul 29 '14 at 7:12

























                      answered Jul 15 '14 at 8:02









                      AndreJAndreJ

                      68.8k562127




                      68.8k562127























                          1














                          I am adding a solution for Unix like systems (tested on MacOS X):
                          If the system $PATH variable is overwritten and that you want to add some paths:




                          • Go under Preferences / System / Environment

                          • "Append" to "Path" the path to the directory (ensure to start the path with ':')

                          • Restart QGis


                          Append a directory to the PATH variable






                          share|improve this answer




























                            1














                            I am adding a solution for Unix like systems (tested on MacOS X):
                            If the system $PATH variable is overwritten and that you want to add some paths:




                            • Go under Preferences / System / Environment

                            • "Append" to "Path" the path to the directory (ensure to start the path with ':')

                            • Restart QGis


                            Append a directory to the PATH variable






                            share|improve this answer


























                              1












                              1








                              1







                              I am adding a solution for Unix like systems (tested on MacOS X):
                              If the system $PATH variable is overwritten and that you want to add some paths:




                              • Go under Preferences / System / Environment

                              • "Append" to "Path" the path to the directory (ensure to start the path with ':')

                              • Restart QGis


                              Append a directory to the PATH variable






                              share|improve this answer













                              I am adding a solution for Unix like systems (tested on MacOS X):
                              If the system $PATH variable is overwritten and that you want to add some paths:




                              • Go under Preferences / System / Environment

                              • "Append" to "Path" the path to the directory (ensure to start the path with ':')

                              • Restart QGis


                              Append a directory to the PATH variable







                              share|improve this answer












                              share|improve this answer



                              share|improve this answer










                              answered Jun 15 '16 at 22:08









                              Bruno von ParisBruno von Paris

                              436620




                              436620























                                  0














                                  I just wanted to point out that Bruno von Paris answer actually works for Windows with a little tweaking in QGIS 3.2.1 (and probably others), simply replace the : in his picture with ;



                                  E.g.



                                  Under Settings -> Options -> System -> Environment, tick 'use custom variables' and enter the following.



                                  Apply = Append



                                  Variable = PATH



                                  Value = ;C:PutPathHere






                                  share|improve this answer




























                                    0














                                    I just wanted to point out that Bruno von Paris answer actually works for Windows with a little tweaking in QGIS 3.2.1 (and probably others), simply replace the : in his picture with ;



                                    E.g.



                                    Under Settings -> Options -> System -> Environment, tick 'use custom variables' and enter the following.



                                    Apply = Append



                                    Variable = PATH



                                    Value = ;C:PutPathHere






                                    share|improve this answer


























                                      0












                                      0








                                      0







                                      I just wanted to point out that Bruno von Paris answer actually works for Windows with a little tweaking in QGIS 3.2.1 (and probably others), simply replace the : in his picture with ;



                                      E.g.



                                      Under Settings -> Options -> System -> Environment, tick 'use custom variables' and enter the following.



                                      Apply = Append



                                      Variable = PATH



                                      Value = ;C:PutPathHere






                                      share|improve this answer













                                      I just wanted to point out that Bruno von Paris answer actually works for Windows with a little tweaking in QGIS 3.2.1 (and probably others), simply replace the : in his picture with ;



                                      E.g.



                                      Under Settings -> Options -> System -> Environment, tick 'use custom variables' and enter the following.



                                      Apply = Append



                                      Variable = PATH



                                      Value = ;C:PutPathHere







                                      share|improve this answer












                                      share|improve this answer



                                      share|improve this answer










                                      answered Sep 22 '18 at 23:49









                                      bdcbdc

                                      111




                                      111






























                                          draft saved

                                          draft discarded




















































                                          Thanks for contributing an answer to Geographic Information Systems Stack Exchange!


                                          • Please be sure to answer the question. Provide details and share your research!

                                          But avoid



                                          • Asking for help, clarification, or responding to other answers.

                                          • Making statements based on opinion; back them up with references or personal experience.


                                          To learn more, see our tips on writing great answers.




                                          draft saved


                                          draft discarded














                                          StackExchange.ready(
                                          function () {
                                          StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fgis.stackexchange.com%2fquestions%2f107204%2fsystem-variable-path-overwritten-in-qgis%23new-answer', 'question_page');
                                          }
                                          );

                                          Post as a guest















                                          Required, but never shown





















































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown

































                                          Required, but never shown














                                          Required, but never shown












                                          Required, but never shown







                                          Required, but never shown







                                          Popular posts from this blog

                                          (145452) 2005 RN43 Классификация | Примечания | Ссылки |...

                                          Щит и меч (фильм) Содержание Названия серий | Сюжет |...

                                          Энтрерриос (город) Содержание История | Географическое...