Trouble on setting up Python RPA development environment

Hi. I’m trying to install Bot City by following the steps in the installation video. When I get to the part of installing the template by the command:

python -m cookiecutter https://github.com/botcity-dev/bot-python-template

I get the message:

vcs.py", line 84, in clone
    raise VCSNotInstalled(msg)
cookiecutter.exceptions.VCSNotInstalled: 'git' is not installed.

I believe this is a problem installing git but not sure, can someone help me?

Hi @pedro-assis,

For the template project you need to have Git installed on your computer as a prerequisite.
Please follow the instructions here to install Git (Git - Downloads) and try again to run the cookiecutter to create the template project.

Thanks for answering me! I followed the Git installation steps and unfortunately I still get the error message. Maybe I should check some option other than the defaults in the installation process, but I don’t know which one. Should I do something after installing?

We are here to help! =)
About the Git Installation, did you close the terminal after installing?
The Git installation adds the git command on the PATH but sometimes the command line can be a bit temperamental of when it ends up getting the new variable.
My recommendation is:

  • Close the terminals that you have open and open them again.
    If that fails, try rebooting your computer to ensure that Git gets inserted on the PATH.
    To verify that everything is okay you should be able to open a terminal and type git.
    If everything is correct you will get the options of the git command.

If that works you can proceed with the cookiecutter and template project.

Let me know how it goes.

Thank you so much! It worked! Now, I advanced in the installation video and reached the part where BotCity Studio is opened. However, when I try to log in, I get the message:
“Can’t connect to Server. Please, verify server address on configuration file.”
What should I do with this file content?

What do you have for your BotStudio conf file under the conf\conf.bcf file?
Make sure you have something like: server=http://server07.botcity.dev.

Are you able to access the BotCity Maestro website?

It worked! I can use BotCity now!
Last doubt (I hope so): I took a screenshot, made my code and when I try to run, I get the message: Failed to read image.png because the file is missing, has improper permissions, or is an unsupported or invalid format. I can see the file on the folder and open it, but I keep getting this message.

@pedro-assis could you paste your bot code here so I can better understand what is going on?
For the find methods, if you image is located in the resources folder it will automatically locate the file so you don’t need to specify full path or even the name with extension. You can simply use:

self.find("image", ....)

First, thank you for helping me, I’m new on Python so maybe I’m missing something. I literally copied the code from this video and changed the website (RPA Python - Criando um robô de navegação Web em com BotCity RPA Python - YouTube), just to test the application, and now I get the error “NameError: name ‘self’ is not defined”

from botcity.core import DesktopBot



class Bot(DesktopBot):
    def action(self, execution):
        self.loadImages()
            
    
        # Opens the Google website.
        self.browse("https://www.google.com")
    if not self.find( "search", matching=0.97, waiting_time=10000):
            self.not_found("search")
            self.click()
        
            self.kb_type("Netflix")
            self.enter()
    def not_found(self, label):
                print(f"Element not found: {label}")
                self.add_image("search", self.get_resource_abspath("search.png"))
            

Hi @pedro-assis ! I’m glad to help!
The video which you are following is a bit older now since we are fast evolving the library.
A couple of things are simpler. I recommend this video here also from our channel as a source for a walkthrough on how to setup your environment and develop a Bot which opens Google and do a search: How to set up your Python RPA development environment - YouTube.

The main issue that I am seeing with your code and the error you are reporting are due to bad code indentation. With Python indentation matters a lot.

The correct code would be like this:

from botcity.core import DesktopBot



class Bot(DesktopBot):
    def action(self, execution):
        # self.loadImages()
    
        # Opens the Google website.
        self.browse("https://www.google.com")
	    if not self.find( "search", matching=0.97, waiting_time=10000):
	        self.not_found("search")
        self.click()
        
        self.kb_type("Netflix")
        self.enter()

    def not_found(self, label):
        print(f"Element not found: {label}")
        self.add_image("search", self.get_resource_abspath("search.png"))

Please note the difference where the code aligns. The video above will guide you through the process of creating an automation with the Python framework in a very nice way.

Let me know how it goes.