Skip to main content
Cadet | Tier 2
January 26, 2022
Question

My Python code is not working

  • January 26, 2022
  • 17 replies
  • 1602 views

Hi,

I have a python code , while executing the python i am getting the correct output.

but at same time when i am calling the same python code through AA 360(V23), its stuck on execution steps. BoT is not retuning any error or output.

17 replies

Most Valuable Pathfinder
January 26, 2022

Hi @Niraj Kumar​ ,

 

Can you share your code snippet?

Chand
Tamil Arasu10
Most Valuable Pathfinder
Most Valuable Pathfinder
January 26, 2022

might, white space, or entering new lines is will cause issue and please function names are defined correctly

Please check the below link for your reference

https://automationanywhere.wistia.com/medias/euyjjrfno4

_Tamil_
Cadet | Tier 2
January 26, 2022

fallow the solution and video mentioned by @Tamil Arasu10 (Customer)​ , even after it didnt resolved before running the bot please preload the python package in the packages section

Cadet | Tier 2
October 14, 2022

Hi @Niraj Kumar​ have you solved the issue?I'm also facing same issue..even basic python code is also not working.It's stucks at the execution step.

NirajknirAuthor
Cadet | Tier 2
October 15, 2022

@Abin Jilson​ yes,

 

Check your environment variable and put your code inside py script folder.

 

If your script is outside py script folder it won't return or execute the code.

Automation Anywhere Team
February 13, 2023

Hi,

 

You can reach out to me, i can be able to help for the python code and integrate well with AA and A360.

Navigator | Tier 3
February 17, 2023

Hi @patelmaulesh ,

 

Can you help me with below code.

It is working in VS studio but in AA it is throwing Bot error.

 

Automation Anywhere Team
February 17, 2023

Hi Ashish,

 

Please share the code and the file that you are using in the code.

Also i found that f is missing from the code “from PyPDF2 import PdfReader, PdfWriter.

Navigator | Tier 3
February 17, 2023

Hi @patelmaulesh 

 

Please find the code below.

 

def PDFCom():

from PyPDF2 import PdfReader,PdfWriter

try:

    Input= 'C:\\Users\\aitware\\Desktop\\Ashish Code\\133100.pdf'

    Output= 'C:\\Users\\aitware\\Desktop\\Ashish Code\\Out.pdf'

 

    reader = PdfReader(Input)

    writer = PdfWriter()

    count= len(reader.pages)

 

    for page in reader.pages:

        page.compress_content_streams()

        writer.add_page(page)

 

    with open(Output, "wb") as f:

        writer.write(f)

except Exception as e: print(e)

Automation Anywhere Team
February 17, 2023

Hi AshishItWare,

 

If possible for you to share the pdf file that would be great as well.

 

I can test the code and will update you soon after getting the file.