DEV Community

Cover image for Hello World challenges: creating my first bot with Python RPA using BotCity
Morganna for BotCity

Posted on • Edited on

Hello World challenges: creating my first bot with Python RPA using BotCity

pt-br: link

We should value our "Hello World" tries more when learning new technologies. It is from there that we begin a journey of exploration and learning. And even because it's a learning process, we can go through some mistakes, and that's ok. It's part of the process too.

Here are some tips on errors you may face in your first steps when building a bot with Python RPA. And if you have experienced an error that is not here in this article, please, feel free to contribute in the comments, especially commenting on the solution you applied to solve the problem.

Gif of a cat using sunglasses and the phrase

First of all... Hello World

Hello World is a joke we play in the technology area, mainly in the software development part, which would be the first thing to do when learning something new to avoid bad luck while using that technology. For example, if you are learning Python, you should show the message "Hello World" on the screen using Python commands.

How to build my first Hello World with Python RPA using BotCity

You can take your first steps into this world with BotCity's Open Source frameworks. Also, explore the documentation, start coding, and the forum to clear your doubts with the community.

Common Mistakes

'ModuleNotFoundError' error when trying to run my project

This error also happens with the message: No module named 'botcity'.

It means you skipped the bot installation step or did that step in a different IDE than the one you are using now.

To resolve the problem, run the following command in the terminal: pip install --upgrade -r requirements.txt. We need to do this because the requirements.txt file has all external dependencies for your robot.

You must run the command above for both BotCity Framework Desktop and BotCity Framework Web. You can have more details in the documentation.

Important: if you use virtual environments to run your project, such as venv, review that you are using the same version of Python to install the dependencies mentioned and run the code. Checking these versions and ensuring they are the same will also avoid some errors.

Error 'OSError: [WinError 216]'

In this error, the complete message can be:

OSError: [WinError 216] This version of %1 is not compatible with the version of Windows you're running. Check your computer's system information and then contact the software publisher
Enter fullscreen mode Exit fullscreen mode

And the scenario is usually this: you are trying to perform the configuration part of a web driver in your code for your web bot, and, in this case, you have chosen the Firefox browser.

# Changing the default Browser to Firefox
bot.browser = Browser.FIREFOX

# Setting the path of the Firefox WebDriver
bot.driver_path = "<path to your WebDriver binary>"
Enter fullscreen mode Exit fullscreen mode

To configure this web driver, we usually download it from this link, where the geckodriver releases are. And then, we identify the correct web driver for our operating system, choosing one of the items in the download assets part:

Screenshot of the assets area from the link mentioned above showing the different driver versions for each system.

It is essential to choose carefully because confusion is common when using, for example, the Windows 64-bit operating system and trying to configure geckodriver-vX.YY.Z-win-aarch64.zip. The correct one would be geckodriver-vX.YY.Z-win64.zip.

By making this correction of using the geckodriver with the correct version, we corrected the error, and you can open the browser through your code automatically.

Driver incompatibility with browser error

It is also important to confirm the browser version you will use and validate that the web driver is compatible with that version. Using Firefox again as an example, you can check the version by looking at Menu > Help > About Firefox.

Firefox screenshot

When validating the version of your browser or the browser that you will use in your automation, check the release information of the selected web driver to verify if it is compatible with the version you will use.

In the example we use, we observe that the Firefox version that I will use in the automation is 114.0.2, and the release contains information that the minimum required version is 113.0:

Screenshot with the text

In this case, I can use that geckodriver version in my automation since it is compatible with my browser.

About the mistakes when we started

It is essential to understand that some mistakes can happen. And this is necessary for your learning. Understanding the error, reading the message calmly, researching, clarifying doubts with the community, and solving this problem will bring you knowledge.

So relax, enjoy this trip, and explore the RPA universe with a lot of Python and Open Source.


How about doing your own Hello World and telling us what challenges it brought to you? Let's share our experiences and knowledge with the community.

And if you want some inspiration on what to build to continue learning, look at our bot repository, where community members share their Open Source projects to exchange knowledge and experiences.

Top comments (2)

Collapse
 
bug_elseif profile image
Bruna Ferreira

Great article!
I want to share that I had a problem with No module named 'botcity' even after installing requirements; what happened to me is that I had more than one version of Python installed on the machine, possibly causing some conflict.
Leaving only one version usually worked.

Collapse
 
morgannadev profile image
Morganna

Thanks for sharing, Bu! Nice tip! And thank you for your support and feedback!