One day in the late 80s, a sudden thought dawned on Guido van Rossum: “Isn’t it crazy that all those people have computers, and very few of them learn to program?” Personal computers have been used for around 20 years, but coding wasn’t as standard among everyday users back then.
Inspired by his work with the ABC programming language, van Rossum set out to make coding more accessible. In 1989, after a few years of development, the first version of his own interpreted, open-source programming language was implemented. Van Rossum named it Python after the popular BBC show Monty Python’s Flying Circus.
Today, Python is the second most popular programming language on GitHub, ranking only behind JavaScript. It’s established itself as a potent, multi-purpose language in data science, data analysis and visualization, machine learning, and web development.
Python is also a perfect fit for RPA development, and its relative simplicity means even non-technical users can leverage it for basic automation. This article investigates its strengths and weaknesses, uses, and case studies featuring automation with Python.
Advantages of Python for business automation
For more than 30 years since its inception, Python has become one of the preferred programming languages for process automation. Why is that?
Easy to learn and read
Accessibility was the guiding principle for van Rossum. Python has a simple, logical syntax that resembles English, making it easy to understand. As a high-level language, Python doesn’t require an in-depth understanding of how computers work, although it helps.
Python is also an interpreted language, meaning each code line can be run and checked immediately. This is a plus for beginners and experienced programmers, too, as Python enables faster development and easier maintenance of automation scripts.
Flexibility
Unlike domain-specific languages such as HTML or SQL, Python wasn’t created to serve any single specific purpose. Instead, it’s a general-use language that can be applied to automate tasks like organizing data, web scraping, sending emails, etc.
Community support and documentation
As an open-source language with a relatively low learning curve, Python has garnered a large and thriving community that actively contributes to its development. With so many engaged users, it’s easy to find answers to questions regarding automation with Python or a fellow programmer willing to help.
A broad range of libraries and frameworks
Another benefit of Python’s large community is a vast ecosystem of user-created libraries and frameworks. They are designed for specific purposes, including various automation tasks, adding to Python’s great versatility. And considering its ease of use, there’s a good chance that even users with basic Python language knowledge can understand and reuse code made by others rather than writing it from scratch.
Platform independence
Python is also a cross-platform language, meaning that automation scripts developed in Python can run on multiple operating systems, including Windows, macOS, and Linux. Thanks to that, programs written in Python are easier to share and deploy at scale across various platforms.
Integration capabilities
Python provides excellent integration capabilities with other programming languages and systems. This includes many languages commonly used in enterprise-scale development, such as Java, PHP, and .NET, which is why Python is well-suited for large and diverse environments.
Rapid development and prototyping
Simplicity, a vast number of high-level libraries, and the fact that it’s an interpreted language all make Python the perfect prototyping tool. Automation allows programmers to quickly iterate, debug, and find the best way to expedite the process.
Performance in RPA
Python is a dynamically typed language, meaning developers don’t need to declare each variable’s type explicitly. Instead, the type of the variable is verified at runtime. While this feature further increases Python’s flexibility and ease of use, it takes its toll on execution time, making Python slower when compared to most general-purpose languages.
However, this isn’t an issue from the RPA perspective. Firstly, in terms of speed, Python is on par with other languages used specifically in RPA. Additionally, workloads can often be parallelized, i.e., divided into smaller parts, which allows for optimized efficiency. Python is also highly performant when it comes to tasks that involve data uploads and downloads through a network, e.g., making HTTP requests.
Cost-effective solution
Python requires no license fees to use and distribute as an open-source language. Combine that with the wide choice of available libraries, rapid development, and short delivery times, and you have an efficient and affordable programming language.
Disadvantages of Python
Despite all its advantages, Python has some flaws that must be considered. What are they?
Memory consumption
Python’s flexibility and ease of use come at the cost of high memory consumption. This might become a concern when dealing with large-scale automation processes or memory-constrained systems.
Global Interpreter Lock (GIL)
To help address memory management, Python uses a Global Interpreter Lock. This feature allows only one thread to execute Python bytecode simultaneously, increasing execution speed for single-thread programs. However, it can also affect the performance of multithreaded Python applications, especially in the case of CPU-bound tasks.
That said, some Python implementations don’t use GIL and can take full advantage of multithreading. It’s also worth noting that GIL isn’t a factor when automating tasks that rely on network capabilities rather than computing power. In such tasks, Python can be applied even to multithreaded programs without compromising execution speed.
Limited mobile development capabilities
Due to its high memory usage and relatively slow performance, Python is subpar regarding mobile-specific automation features or cross-platform mobile app development. Other languages like Swift, Kotlin, or JavaScript may be more suitable.
Runtime errors
The fact that Python is a dynamically typed language means that the data type of any variable can change at any time. Also, Python doesn’t compile until runtime, so many problems go unnoticed up to that point. This may lead to runtime issues like syntax errors.
Version compatibility issues
Python has been around for over 30 years, and throughout that time, it has seen many upgrades. Though new versions expand Python’s capabilities, they also cause incompatibility with some runtimes in cloud environments.
What processes can you automate with Python?
Considering all strengths and weaknesses of the language, let’s see some of the best use cases for automation with Python.
- Email automation — Python has a built-in smptlib module, allowing easy integration with Simple Mail Transfer Protocol (SMTP), the communication protocol used by all email systems. Once a connection is set up, you can use Python to bulk-send personalized emails, organize your inbox, or sort messages from different mailboxes.
- Web scraping — With specialized libraries, Python allows you to automatically collect and parse data directly from the website’s HTML. This has a range of applications, from comparing prices or product listings to statistical research.
- File conversion — Python scripts can quickly convert high volumes of files from one format to another. Examples include text, image, and even text-to-speech conversion.
- Document reading and editing — No matter the size of your CSV table, a Python script can scan it in seconds and make the necessary changes. The algorithm can also be used to fill online forms automatically.
- File upload — When done manually, moving thousands of files to a new location can take days. Python can handle data uploads between devices or cloud storage much more efficiently.
- Web search automation — Tasks like web mining or SEO auditing require constant, repetitive Google searching for the exact keywords. Python scripts will scrape search results quickly, accurately, and in real-time.
- Customer segmentation — Dividing your clients based on their characteristics involves reading and manipulating extensive records. Scripts created in Python can scan these datasets for shared customer features such as behavior or demographic data and then group them into segments for further analysis.
- Integrations — Python can be used for integrating systems that have no native way of connecting with each other (you’ll probably word it better than me, but you get the point)
Automation with Python — our work
Enough theory—let’s see how automation with Python fares in real-life scenarios based on two client stories from our Flobotics portfolio.
eSky — 1.5 full-time equivalent saved monthly on partner monitoring
eSky is a leading travel portal offering many services, including flights, accommodation, holiday packages, and travel-related services: car rental, insurance, tours, and more.
With an offering this varied, eSky needs to constantly monitor the websites of external providers (e.g., airlines or insurance companies) for any pricing or policy changes. Tracking is particularly problematic in the case of luggage policies which are often hard to find and updated irregularly. Due to that, updates were handled manually, which led to errors and outdated information being posted on eSky’s website.
We decided to use two technologies after an introductory workshop with the client. First, our developers created a prototype bot in Python. Here, the properties of the language allowed us to validate the concept and make the necessary tweaks on the go. When the prototype passed the feasibility test, we started working on the final automation using Robocorp, a Python-based tool.
The result was an efficient but easy-to-maintain automation solution that tracks real-time luggage policy changes on over 200 pages. The investment paid for itself in just 2 months and helped eSky save 1.5 full-time equivalents each month.
EBTCS — integrating crucial systems
The Evidence-Based Treatment Centers of Seattle (EBTCS) is a Seattle-based network of specialty mental health centers. EBTCS struggled to integrate its sales portal (Salesforce) with the EHR system (Valant), which doesn’t have an open API. So, to keep all data up to date across both platforms, a whole team was needed to move records manually between Salesforce and Valant every day.
At first, the client wanted to use UiPath, our RPA technology of choice. However, after a short analysis, we decided to again go for Python and Robocorp. Python’s integration capabilities would allow us to build a bot that worked with Valant without using its interface, expediting the process significantly. Also, based on the average monthly usage, Robocorp was the most cost-efficient solution.
The bot checks EBTCS’ Salesforce every three hours and compares patient data with the list of patients in Valant. The algorithm pulls all their data from Salesforce into Valant if new patients are registered. Once the transfer is complete, the bot automatically updates the patient status and sends a short report to all relevant team members.
We’ve also implemented additional features, such as the automated transfer of personal data and PDF documents between the platforms, a billing error prevention system for Valant, and a bot performance monitoring dashboard.
The bot now handles up to hundreds of cases per week, and the processing time for each case was reduced from 5 minutes to just 15 seconds. EBTCS paid nothing for the license since Robocorp’s free plan covered the project scope.
What can automation with Python do for your business?
Simplicity, user-friendly features, and flexibility make Python a versatile tool well-suited for various purposes. One of them is automating processes crucial to daily operations in any industry.
At Flobotics, we specialize in helping businesses streamline their processes using automation solutions like UiPath, Blue Prism, Automation Anywhere, and more—including Python. Want to find out more? Drop us a line, schedule a free consultation, and let’s talk about the best automation technology for your business.