Issue running RPA.Desktop.Windows

Hi,

I’m getting this issue when trying to run calculator.py which is no more less the example in the documentation :
any insights ?

thanks

[ ERROR ] Error in file 'd:\rpa\robot01\tasks.robot' on line 4: Importing library 'd:\rpa\robot01\calculator.py' failed: SyntaxError: invalid syntax (__init__.py, line 375)
Traceback (most recent call last):
  File "d:\rpa\robot01\calculator.py", line 1, in <module>
    from RPA.Desktop.Windows import Windows
  File "C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib\site-packages\RPA\Desktop\__init__.py", line 10, in <module>
    import comtypes.client
PYTHONPATH:
  d:\rpa\robot01
  c:\Users\albel\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_debug_adapter
  d:\rpa\robot01
  c:\Users\albel\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src
  c:\Users\albel\.vscode\extensions\robocorp.robotframework-lsp-0.35.0\src\robotframework_ls\vendored
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\python39.zip
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\DLLs
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib\site-packages
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib\site-packages\win32
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib\site-packages\win32\lib
  C:\Users\albel\AppData\Local\robocorp\holotree\b1f3c244e_59f207d3\lib\site-packages\Pythonwin

my python file is :

from RPA.Desktop.Windows import Windows
win = Windows()
def open_calculator():
    win.open_from_search("calc.exe", "Calculator")
    elements = win.get_window_elements()

def make_calculations(expression):
    win.send_keys(expression)
    result = win.get_element_rich_text('id:CalculatorResults')
    return int(result.strip('Display is '))

def run_calculator():
    open_calculator()
    exp = '5*2='
    result = make_calculations(exp)
    print(f"Calculation result of '{exp}' is '{result}'")
    win.close_all_applications()

if __name__ == "__main__":
    run_calculator()

My task.robot file :

*** Settings ***
Documentation     Robot01 description
Library           task.py
Library           calculator.py

*** Tasks ***
robot01
    #connect to sangoma
    #connect with playwright
    run calculator

My conda.yaml file :

channels:
  # Define conda channels here.
  - conda-forge
dependencies:
  # Define conda packages here.
  # If available, always prefer the conda version of a package, installation will be faster and more efficient.
  # https://anaconda.org/search
  - python=3.9.7
  - pip=21.2
  - nodejs=16.13.0
  - pip:
    # Define pip packages here.
    # https://pypi.org/
    - robotframework-browser==11.1.1
    - rpaframework==12.2.0 # https://rpaframework.org/releasenotes.html
    - playwright==1.17.2
rccPostInstall:
  - rfbrowser init
1 Like

Hi @arcondo.dasilva,

This error maybe related to another issue were are seeing with RPA.Desktop and Setup Tools. Will get back to here as soon as we figure out what is going on.

Sorry for the hassle.

Best,
Tim

Hi @arcondo.dasilva,

The team has been working hard to solve this issue and it should now be resolved by updating your conda.yaml file rpaframework version to 12.5.1 (“rpaframework==12.5.1”). Please let me know if you have any questions or further issues.

Best,
Tim

2 Likes

Great ! That works.
Thanks a lot for your help. I can move foreward.

1 Like