Skip to main content
Cadet | Tier 2
March 2, 2023
Solved

Python returns Bot error while running the execute script command

  • March 2, 2023
  • 8 replies
  • 1127 views

I’m trying to run a python script as import file command. it simple give me a message as bot error but when i run the same script in IDE it works fine and generates the expected output. not sure what was missing while using AA command. Adding the code snippet for reference

f = open("samplefile1.txt", "w")
f.write("Hello World from python")
f.close()
 

    Best answer by Raul Jaimes

    @rajeshramu 

    It worked for me with the absolute path and “/” instead of “\”

    f = open("C:/test/samplefile1.txt", "w")

    f.write("Hello World from python")

    f.close()

     

     

    HTH

    Regards

    8 replies

    Padmakumar
    Premier Pathfinder | Tier 7
    Premier Pathfinder | Tier 7
    March 2, 2023

    Hi @rajeshramu ,

     

    Can you share the Execute Python action’s screenshot?

    Padmakumar
    Cadet | Tier 2
    March 2, 2023

     

    Padmakumar
    Premier Pathfinder | Tier 7
    Premier Pathfinder | Tier 7
    March 2, 2023

     

     

    Kindly share the details of Execute Script part.

     

    Padmakumar
    Cadet | Tier 2
    March 2, 2023

    Hi Padmakumar, 

    Nothing much in execute command just the session name and output variable.

     

    Padmakumar
    Premier Pathfinder | Tier 7
    Premier Pathfinder | Tier 7
    March 2, 2023

    Hi Padmakumar, 

    Nothing much in execute command just the session name and output variable.

     

     

    Ok.  Refer this article and follow any of the workaround suggested and see whether it is helping or not.

     

    Padmakumar
    Raul Jaimes
    Navigator | Tier 3
    March 2, 2023

    @rajeshramu 

    It worked for me with the absolute path and “/” instead of “\”

    f = open("C:/test/samplefile1.txt", "w")

    f.write("Hello World from python")

    f.close()

     

     

    HTH

    Regards

    Cadet | Tier 2
    March 2, 2023

    @Raul Jaimes Thanks a lot!! it worked now.. earlier i tried the absolute path before but using backward slash. 

    Cadet | Tier 2
    March 2, 2023

    Hi Padmakumar, 

    Nothing much in execute command just the session name and output variable.

    Thanks Padmakumar for sharing the article as well.

     

     

    Ok.  Refer this article and follow any of the workaround suggested and see whether it is helping or not.