This article shows you step-by-step how to setup RPA for Python, or TagUI-Python, which I still like to call it because I started from the TagUI days. You can refer to the details of the name change here.

To a technical person, setting up TagUI-Python is easy, just a simple

pip install tagui

However, to someone who has never used python or pip before, it's surprisingly complicated, as it includes the following 3 main steps on Mac:

  1. Install Python
  2. Install TagUI-Python
  3. Install additional libraries if necessary

If you are on Windows 10, please refer to my other article: Setup TagUI-Python on Windows 10.

Let me walk through the details with you.

Step 1. Setup Python

First, let's make sure that you have Python installed on your machine.

  1. Launch Applications > Utilities > Terminal as shown below.
  2. In the Terminal window, type the following 2 commands:
  3. which python3
    which pip3

  4. If you see the screen below, then you have Python 3 installed on your machine.
  5. If you see the following screen instead, then please follow the instructions in the article "Install Python on Mac" to install Python.
  6. In the Terminal window, type the following command:
  7. python3

    If you see the screen below, it means Python 3 is running ok on your machine.

  8. Press Ctrl+D to exit the Python Interpreter. In the Terminal window, now type the following command:
  9. pip3 list

    If you see the screen below, it means pip3, the application manager that is used to install Python packages, is running ok on your machine.

  10. We are now ready to install Tagui-Python!

Step 2. Install Tagui-Python

  1. Open a Terminal and type:
  2. pip3 install tagui

  3. If everything ok, you will see the following message:

Step 3. Setup Tagui-Python

  1. First, make sure you have Google's Chrome browser installed. TagUI-Python is designed to run best with Google Chrome browser.
  2. If you do not have Google Chrome browser, click the following link to install Google Chrome browser before you proceed: Install Google Chrome broswer

  3. Start python3 in a Terminal following Step 1.5 above. Once you are in Python, type the following:
  4. import tagui as t
    t.init()

  5. You will first see an empty Chrome browser appeared:
  6. If everything is ok, you will also see a True in the Python window as shown below:
  7. Note that if this is the first time you run TagUI, it might take all the way from a couple of seconds to a few minutes for the True to appear. Just be patient and wait for True to appear.

    If the True did not appear after 10 minutes, please close the command prompt, restart a new command prompt and then go back to Python again. Repeat the previous step to key in the 2 commands, i.e. import tagui as t followed by t.init().

    If you do not see True, or you see a False instead, please refer to Troubleshooting below.

  8. Now copy and paste the following commands into the Python Terminal:
  9. t.url('https://google.com')
    t.type('//input[@name="q"]', "weather singapore[enter]")
    temp = t.read('//span[@id="wob_tm"]')
    print("temperature = " + temp)

  10. If you see something similar to the following output, then your TagUI-Python is up and running!
  11. On the browser side, you will see TagUI automatically open the Google search page, enter weather singapore in the search field, press the Enter key, grab the current temperature from the search result, and display the temperature in the Python window. Your final browser window will look like the following:

  12. Congratulations! You have successfully installed and setup TagUI-Python!

Troubleshooting

1. Dyld: Library not loaded error (missing libssl.1.0.0.dylib)

If you get the following error message:

It’s because the openssl library is not installed on your machine.

To resolve this:

  1. Install Homebrew on your Mac if you haven’t. Homebrew is the most popular package manager for Mac OS that makes installation of software such as Python, wget or openssl fast and easy.
  2. Install wget:
  3. brew install wget

  4. Download the file:
  5. wget https://github.com/tebelorg/Tump/releases/download/v1.0.0/openssl.rb

  6. Install the openssl library:
  7. brew install openssl.rb

2. SSL: CERTIFICATE_VERIFY_FAILED error

If you get the following error message:

urllib.error.URLError: <urlopen error [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed: unable to get local issuer certificate (_ssl.c:1049)>

Please refer to this article: SSL: CERTIFICATE_VERIFY_FAILED error for http://en.wikipedia.org

Try the solution as given there:

Once upon a time I stumbled with this issue. If you're using macOS go to Macintosh HD > Applications > Python3.6 folder (or whatever version of python you're using) > double click on "Install Certificates.command" file

If you installed Python using Homebrew the file Install Certificates.command may not exists. Go to the following article. It will tell you where to find that file.

brew installation of Python 3.6.1: [SSL: CERTIFICATE_VERIFY_FAILED] certificate verify failed

That’s it! TagUI should now be able to run on your Mac!

Add comment

Submit