5 Replies Latest reply on Oct 14, 2016 12:43 PM by jegan.sivaraj

    Login error to Tableau Server

    jegan.sivaraj

      I inherited python code(with rest api) used to login to the server and update local user groups. I have very limited experience with both python and rest api.

       

      The program was working fine until last week when it started throwing this error - 'ascii' codec can't decode byte 0xe2 in position 10580: ordinal not in range(128)

       

      Anyone know how to troubleshoot this?

       

      Thank you,

      Jegan

        • 1. Re: Login error to Tableau Server
          jegan.sivaraj

          Here is the part where it throws the error -

           

          out("  Login to Tableau Server")

           

           

          _tableau = TableauRestApi(_config["server"]["url"],

                                   _username,

                                   _password,

                                   _config["server"]["site"])

          try:

             

              _tableau.signin()

             

          except Exception as e:

             

              error_message = "Tableau Server login failed: " + str(e)

              out(error_message)

             

              if _config["behavior"]["do_failure_notifying"]:

                  send_notification(error_message, NOTIFICATON_TYPE_ERROR)

                 

              exit(0)

          • 2. Re: Login error to Tableau Server
            Matt Coles

            Sounds like you're using ASCII strings but the error response from Tableau Server contains Unicode values. Try this:

             

            error_message = u"Tableau Server login failed: " + str(e)

             

            whatever send_notification does will need to expect Unicode strings in the error_message argument too.

            • 3. Re: Login error to Tableau Server
              jegan.sivaraj

              Thanks Matt.

               

              I get the same error when I run the code in the command prompt too. do you think the issue is with str(e)? Any way to decode the exception e?

               

              Thank you,

              Jegan

              • 4. Re: Login error to Tableau Server
                Matt Coles

                It's when you try and do something with your final string that is most likely the issue. Hard to say without seeing all your code though, and I don't know what version of Python you're using. Would recommend the change above, and you can try casting to the unicode type like so:

                 

                error_message = u"Tableau Server login failed: " + unicode(e)

                 

                but typically you'd use the format method:

                 

                error_message = u"Tableau Server login failed:{} ".format(e)

                 

                Basically, working with Unicode data (as everyone does nowadays) in Python 2.x is a pain. Google is your friend, the answers are out there.

                1 of 1 people found this helpful
                • 5. Re: Login error to Tableau Server
                  jegan.sivaraj

                  Thanks for the help. I'll close this thread and search for python solutions.

                   

                  Thank you.