Skip to main content
Solved

Python returns Bot error while running the execute script command


Forum|alt.badge.img+2

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

View original
Did this topic help answer your question?

8 replies

Padmakumar
Forum|alt.badge.img+14
  • Flight Specialist | Tier 4
  • 786 replies
  • March 2, 2023

Hi @rajeshramu ,

 

Can you share the Execute Python action’s screenshot?


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 5 replies
  • March 2, 2023

 


Padmakumar
Forum|alt.badge.img+14
  • Flight Specialist | Tier 4
  • 786 replies
  • March 2, 2023
rajeshramu wrote:

 

 

Kindly share the details of Execute Script part.

 


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 5 replies
  • March 2, 2023

Hi Padmakumar, 

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

 


Padmakumar
Forum|alt.badge.img+14
  • Flight Specialist | Tier 4
  • 786 replies
  • March 2, 2023
rajeshramu wrote:

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.

 


Raul Jaimes
Forum|alt.badge.img+9
  • Navigator | Tier 3
  • 494 replies
  • Answer
  • 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


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 5 replies
  • March 2, 2023

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


Forum|alt.badge.img+2
  • Author
  • Cadet | Tier 2
  • 5 replies
  • March 2, 2023
Padmakumar wrote:
rajeshramu wrote:

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.

 

 


Cookie policy

We use cookies to enhance and personalize your experience. If you accept you agree to our full cookie policy. Learn more about our cookies.

 
Cookie settings