Skip to main content
cancel
Showing results for 
Search instead for 
Did you mean: 

We've captured the moments from FabCon & SQLCon that everyone is talking about, and we are bringing them to the community, live and on-demand. Starts on April 14th. Register now

Reply
Romani
Helper II
Helper II

Power BI Python Script Issue

# Import the translation library
from textblob import TextBlob

# Create a function for translation
def translation(text):
blob = TextBlob(text)
return str(blob.translate(from_lang='ar', to='en'))

# Apply the translation function to the relevant column in the dataset
dataset['translation'] = dataset['Comment'].apply(translation)

i couldnt resolve the below issue:
DataSource.Error: ADO.NET: Python script error.
<pi>Traceback (most recent call last):
File "C:\Users\romany.fahmy\PythonScriptWrapper_f98538af-0b94-4b4f-8564-167f0283ffcc\PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
ModuleNotFoundError: No module named 'matplotlib'
</pi>
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
<pi>Traceback (most recent call last):
File "C:\Users\romany.fahmy\PythonScriptWrapper_f98538af-0b94-4b4f-8564-167f0283ffcc\PythonScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib
ModuleNotFoundError: No module named 'matplotlib'
</pi>
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

4 REPLIES 4
Anonymous
Not applicable

Hi @Romani ,

Does the information provided by some_bih help you solve your problem? If it helps, please accept the responses you find helpful as solution.

Best Regards,
Dino Tao

some_bih
Community Champion
Community Champion

Hi @Romani did you try with import part 

import matplotlib.pyplot as plt

 

check link for other work python in power bi





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






# 'dataset' holds the input data for this script

# Import the translation library
from textblob import matplotlib.pyplot as plt

# Create a function for translation
def translation(text):
blob = TextBlob(text)
return str(blob.translate(from_lang='ar', to='en'))

# Apply the translation function to the relevant column in the dataset
dataset['translation'] = dataset['Comment'].apply(translation)

after your update the below issue appeared:
DataSource.Error: ADO.NET: Python script error.
<pi> File "C:\Users\romany.fahmy\PythonScriptWrapper_1a152b9c-825d-4fbb-b52c-05213fa30147\PythonScriptWrapper.PY", line 18
from textblob import matplotlib.pyplot as plt
^
SyntaxError: invalid syntax
</pi>
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=Python script error.
<pi> File "C:\Users\romany.fahmy\PythonScriptWrapper_1a152b9c-825d-4fbb-b52c-05213fa30147\PythonScriptWrapper.PY", line 18
from textblob import matplotlib.pyplot as plt
^
SyntaxError: invalid syntax
</pi>
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonScriptRuntimeException

some_bih
Community Champion
Community Champion

Hi @Romani check community experience for your error

https://community.fabric.microsoft.com/t5/Desktop/Microsoft-PowerBI-Scripting-Python-Exceptions/m-p/... 





Did I answer your question? Mark my post as a solution!

Proud to be a Super User!






Helpful resources

Announcements
New to Fabric survey Carousel

New to Fabric Survey

If you have recently started exploring Fabric, we'd love to hear how it's going. Your feedback can help with product improvements.

Power BI DataViz World Championships carousel

Power BI DataViz World Championships - June 2026

A new Power BI DataViz World Championship is coming this June! Don't miss out on submitting your entry.

Join our Fabric User Panel

Join our Fabric User Panel

Share feedback directly with Fabric product managers, participate in targeted research studies and influence the Fabric roadmap.

March Power BI Update Carousel

Power BI Community Update - March 2026

Check out the March 2026 Power BI update to learn about new features.