python lsb_release not working in debian 9

The name of the pictureThe name of the pictureThe name of the pictureClash Royale CLAN TAG#URR8PPP











up vote
0
down vote

favorite












I cannot get lsb_release module to work in python 2.7 or 3 on debian 9. I haven't tried on debian 8 yet but I need it to work on both.



Here's what I tried:



import lsb_release
print(lsb_release.get_lsb_information())


it returned I don't get an import error, I don't know why it doesn't work. Also, when running a script via sudo with user = os.environ['SUDO_USER'] I get a key error, SUDO_USER doesn't exist? What gives?







share|improve this question
























    up vote
    0
    down vote

    favorite












    I cannot get lsb_release module to work in python 2.7 or 3 on debian 9. I haven't tried on debian 8 yet but I need it to work on both.



    Here's what I tried:



    import lsb_release
    print(lsb_release.get_lsb_information())


    it returned I don't get an import error, I don't know why it doesn't work. Also, when running a script via sudo with user = os.environ['SUDO_USER'] I get a key error, SUDO_USER doesn't exist? What gives?







    share|improve this question






















      up vote
      0
      down vote

      favorite









      up vote
      0
      down vote

      favorite











      I cannot get lsb_release module to work in python 2.7 or 3 on debian 9. I haven't tried on debian 8 yet but I need it to work on both.



      Here's what I tried:



      import lsb_release
      print(lsb_release.get_lsb_information())


      it returned I don't get an import error, I don't know why it doesn't work. Also, when running a script via sudo with user = os.environ['SUDO_USER'] I get a key error, SUDO_USER doesn't exist? What gives?







      share|improve this question












      I cannot get lsb_release module to work in python 2.7 or 3 on debian 9. I haven't tried on debian 8 yet but I need it to work on both.



      Here's what I tried:



      import lsb_release
      print(lsb_release.get_lsb_information())


      it returned I don't get an import error, I don't know why it doesn't work. Also, when running a script via sudo with user = os.environ['SUDO_USER'] I get a key error, SUDO_USER doesn't exist? What gives?









      share|improve this question











      share|improve this question




      share|improve this question










      asked Nov 20 '17 at 6:27









      answerSeeker

      3541413




      3541413




















          1 Answer
          1






          active

          oldest

          votes

















          up vote
          2
          down vote



          accepted










          Please don’t ask multiple questions in one.



          Regarding your first question, you should use get_distro_information() instead. get_lsb_information() is used internally to load overrides from /etc/lsb-release; get_distro_information() uses that, along with other methods in the class, to provide the appropriate information.



          Regarding your second question, if SUDO_USER really isn’t present in the environment exported by sudo (run sudo env to check), that probably means that your sudoers configuration deletes the variable from the environment.






          share|improve this answer




















            Your Answer







            StackExchange.ready(function()
            var channelOptions =
            tags: "".split(" "),
            id: "106"
            ;
            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',
            convertImagesToLinks: false,
            noModals: false,
            showLowRepImageUploadWarning: true,
            reputationToPostImages: null,
            bindNavPrevention: true,
            postfix: "",
            onDemand: true,
            discardSelector: ".discard-answer"
            ,immediatelyShowMarkdownHelp:true
            );



            );













             

            draft saved


            draft discarded


















            StackExchange.ready(
            function ()
            StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405709%2fpython-lsb-release-not-working-in-debian-9%23new-answer', 'question_page');

            );

            Post as a guest






























            1 Answer
            1






            active

            oldest

            votes








            1 Answer
            1






            active

            oldest

            votes









            active

            oldest

            votes






            active

            oldest

            votes








            up vote
            2
            down vote



            accepted










            Please don’t ask multiple questions in one.



            Regarding your first question, you should use get_distro_information() instead. get_lsb_information() is used internally to load overrides from /etc/lsb-release; get_distro_information() uses that, along with other methods in the class, to provide the appropriate information.



            Regarding your second question, if SUDO_USER really isn’t present in the environment exported by sudo (run sudo env to check), that probably means that your sudoers configuration deletes the variable from the environment.






            share|improve this answer
























              up vote
              2
              down vote



              accepted










              Please don’t ask multiple questions in one.



              Regarding your first question, you should use get_distro_information() instead. get_lsb_information() is used internally to load overrides from /etc/lsb-release; get_distro_information() uses that, along with other methods in the class, to provide the appropriate information.



              Regarding your second question, if SUDO_USER really isn’t present in the environment exported by sudo (run sudo env to check), that probably means that your sudoers configuration deletes the variable from the environment.






              share|improve this answer






















                up vote
                2
                down vote



                accepted







                up vote
                2
                down vote



                accepted






                Please don’t ask multiple questions in one.



                Regarding your first question, you should use get_distro_information() instead. get_lsb_information() is used internally to load overrides from /etc/lsb-release; get_distro_information() uses that, along with other methods in the class, to provide the appropriate information.



                Regarding your second question, if SUDO_USER really isn’t present in the environment exported by sudo (run sudo env to check), that probably means that your sudoers configuration deletes the variable from the environment.






                share|improve this answer












                Please don’t ask multiple questions in one.



                Regarding your first question, you should use get_distro_information() instead. get_lsb_information() is used internally to load overrides from /etc/lsb-release; get_distro_information() uses that, along with other methods in the class, to provide the appropriate information.



                Regarding your second question, if SUDO_USER really isn’t present in the environment exported by sudo (run sudo env to check), that probably means that your sudoers configuration deletes the variable from the environment.







                share|improve this answer












                share|improve this answer



                share|improve this answer










                answered Nov 20 '17 at 9:12









                Stephen Kitt

                143k22312377




                143k22312377



























                     

                    draft saved


                    draft discarded















































                     


                    draft saved


                    draft discarded














                    StackExchange.ready(
                    function ()
                    StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2funix.stackexchange.com%2fquestions%2f405709%2fpython-lsb-release-not-working-in-debian-9%23new-answer', 'question_page');

                    );

                    Post as a guest













































































                    Popular posts from this blog

                    How to check contact read email or not when send email to Individual?

                    Bahrain

                    Postfix configuration issue with fips on centos 7; mailgun relay