Forum Discussion
python script error
Hi jmandavia,
Can you please provide more detail information to help us clarify your scenario?(e.g, python version, desktop version, datasource you connect)
According to your error message, it seems like a script error during progress. Have you double check and debug your code?
Regards,
Xiaoxin Sheng
- shuaho7 years agoFrequent Visitor
I have the similar error, my python script works well outside of PowerBI, but get below error:
We encountered an error while trying to connect.
Details:"ADO.NET:Python script error.
Traceback(most recent call last):
File "PythoScriptWrapper.PY", line 2, in <module>
import os, pandas, matplotlib.pyplot
ImportError: No module name pandas
I don't have pandas in the script, Here is my script:
import requests
import jsonurl='https://api-XXXXXX.com/api/1.0/authentication/XXXXXXXXX/login'
data='''{
"userName": "XXX",
"password": "XXX"
}
'''
headers = {
"content-Type":"application/json"
}resp = requests.post(url, headers=headers, data=data, verify=False)
jData = json.loads(resp.content)
token = jData['accessToken']- Anonymous7 years agoNot applicable
Have installed Python through Anaconda? That's most likelly the problem. I installed python 3.6 on its own and was able to integrate python script into PBI. Then I installed python 3.7 through Anaconda and got similar error for the same script that gave me no issues previously. I repointed PBI to the 3.6 interpreter and it runs fine again. So the issue is either with python 3.7 or with how it is managed by Anaconda. My guess is it's Anaconda and hence the irony that I went for it for convinience...
- VShah7 years agoFrequent Visitor
Thanks a lot for your reply. Will give it a try tomorrow. Will also try downloading python 3.7 directly instead of through Anaconda and check
- Matej_Samler7 years agoRegular Visitor
Hi,
Since PBI is giving the table as an input to your python step in the form of pandas.DataFrame, you need to have pandas installed on your computer, even though your script doesn't use it. Power BI needs to have access to the library in order to evaluate your code and pass inputs into it. - rajatanand6 years agoRegular Visitor
Pandas is a mandatory requirement for running script in PowerBI as per official documentation. Even if you don't use it power bi requires it to be installed in your system.