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 / I got this error when ...
Power Automate
Answered

I got this error when executing a python script : "ImportError: No module named json"

(0) ShareShare
ReportReport
Posted on by 12

Hi !

I'm trying to execute a python script to retrieve delivery and engagement statistics on Mailjet. I have convert the response of the API to pandas table, it works find in my IDE but in PAD I have the following error :

 

 

 

Traceback (most recent call last):
 File "<string>", line 1, in <module>
 File "C:\Users\dhandas\venvs\mailjet2.7\Lib\site-packages\mailjet_rest\__init__.py", line 3, in <module>
 File "C:\Users\dhandas\venvs\mailjet2.7\Lib\site-packages\mailjet_rest\client.py", line 4, in <module>
ImportError: No module named json

 

 

 

 

But I did specify the path for my modules : 

Daoud_H_0-1715866806231.png

 

And this is my code : 

 

 

 

from mailjet_rest import Client
import pandas as pd
import simplejson

# Define the API key and secret
MJ_APIKEY_PUBLIC = my_public_key 
MJ_APIKEY_PRIVATE = my_private_key 
mailjet = Client(auth=(MJ_APIKEY_PUBLIC, MJ_APIKEY_PRIVATE), version='v3')

# Get the list of campaigns
filters = {
 'IDType' : 'campaign',
 'limit' : 1000
}

campaigns = mailjet.campaignoverview.get(filters=filters)

campaigns_json = simplejson.dumps(campaigns.json(), indent=4)

campaigns_df = pd.read_json(campaigns_json)



campaigns_df = campaigns_df['Data'].apply(pd.Series)[['ID', 'Subject', 'Title']]

print(campaigns_df) 

 

 

 

 

Thank you for your help !

I have the same question (0)
  • Steveg48 Profile Picture
    28 on at

    did you pip install simplejson? Try with json instead of simplejson. No need to install json

  • Daoud_H Profile Picture
    12 on at

    Hi @Steveg48,

     

    At the beginning I was using json, and it gave me the same error, that's when I replaced it with simplejson. 

     

  • Verified answer
    Daoud_H Profile Picture
    12 on at

    I find a solution for my issue.

    Instead of executing my script with pyton, i use a script Powershell so i can activate my env and then execute my python script ! 

    Daoud_H_0-1715951744325.png

     

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

Introducing the 2026 Season 1 community Super Users

Congratulations to our 2026 Super Users!

Kudos to our 2025 Community Spotlight Honorees

Congratulations to our 2025 community superstars!

Congratulations to the March Top 10 Community Leaders!

These are the community rock stars!

Leaderboard > Power Automate

#1
Haque Profile Picture

Haque 573

#2
Valantis Profile Picture

Valantis 407

#3
11manish Profile Picture

11manish 387

Last 30 days Overall leaderboard