web
You’re offline. This is a read only version of the page.
close
Skip to main content

Announcements

News and Announcements icon
Community site session details

Community site session details

Session Id :
Power Platform Community / Forums / Power Automate / Trying to get this pyt...
Power Automate
Answered

Trying to get this python script to run but running into issues

(0) ShareShare
ReportReport
Posted on by 2

Hello!

 

I am try to run the following script:

from datetime import datetime
from dateutil.relativedelta import relativedelta
# current dateTime
now = datetime.now()
previousmonth = datetime.now()-relativedelta(months=1)

short_mon = previousmonth.strftime("%%b")

print(short_mon)

 When I run the code I get:

Traceback (most recent call last):
File "<string>", line 2, in <module>
ImportError: No module named dateutil.relativedelta

Is there a way to add this to powerautomate so that it can function?

 

I have the same question (0)
  • Verified answer
    Henrik_M Profile Picture
    2,021 Super User 2024 Season 1 on at

    Not sure. PAD runs an ancient version of Python, so that module is probably not included.

    However, I do know that you can achieve a similar result using three actions within PAD:

    1. Get current date and time
    2. Add to datetime
    3. Convert datetime to text

Under review

Thank you for your reply! To ensure a great experience for everyone, your content is awaiting approval by our Community Managers. Please check back later.

Helpful resources

Quick Links

Season of Sharing Community Challenge Winners!

Congratulations to our community stars!

Kudos to our 2025 Community Spotlight Honorees

Expanding mentorship, skilling, and AI innovation

Congratulations to the July Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
David_MA Profile Picture

David_MA 247 Super User 2026 Season 2

#2
11manish Profile Picture

11manish 164 Super User 2026 Season 2

#3
trice602 Profile Picture

trice602 138 Super User 2026 Season 2

Last 30 days Overall leaderboard