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

Earn a 50% discount on the DP-600 certification exam by completing the Fabric 30 Days to Learn It challenge.

Python Script Error in PBI

I am setting up a python script in Power BI (Pro). So my route is Get Data > Python > Paste in my script. The script runs fine in Jupyter Lab, but when I close the Python Script Window, I get this error:

 

Details: "ADO.NET: Python script error.
<pi>urllib.error.HTTPError: HTTP Error 401: Unauthorized
</pi>"

 

Any ideas? This used to work.

 

TIA

Status: Investigating

Hi @jleglen ,

 

The HTTP 401 Unauthorized client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource.

If your request returns a 401, then redo your authentication and try again. Ensure that the necessary permissions are granted for your app. If you’re trying to access the PowerBI resource, you might need to check PowerBI service permission.

If you’re getting a 401 error, it means that there’s no permission to access the resource. You can use JWT.io to decode the token and check the audience and permissions.

If you have a permission checked that says “Requires Admin”, then you need an admin to click "Grant Permissions".

 

Best Regards,
Community Support Team _ Caitlyn

Comments
v-xiaoyan-msft
Community Support
Status changed to: Investigating

Hi @jleglen ,

 

The HTTP 401 Unauthorized client error status response code indicates that the request has not been applied because it lacks valid authentication credentials for the target resource.

If your request returns a 401, then redo your authentication and try again. Ensure that the necessary permissions are granted for your app. If you’re trying to access the PowerBI resource, you might need to check PowerBI service permission.

If you’re getting a 401 error, it means that there’s no permission to access the resource. You can use JWT.io to decode the token and check the audience and permissions.

If you have a permission checked that says “Requires Admin”, then you need an admin to click "Grant Permissions".

 

Best Regards,
Community Support Team _ Caitlyn

jleglen
Frequent Visitor

I did check the permissions on SharePoint and they are at Full Control. If I download the file to OneDrive, the script works fine.