cancel
Showing results for 
Search instead for 
Did you mean: 

Fabric is Generally Available. Browse Fabric Presentations. Work towards your Fabric certification with the Cloud Skills Challenge.

Reply
FaresBI
New Member

python Access Denied

I am trying to run a python script on some data I keep getting this error even If I run nothing like I just run it still gives me this code 

 

 

DataSource.Error: ADO.NET: A problem occurred while processing your Python script.
Here are the technical details: Access is denied
Details:
DataSourceKind=Python
DataSourcePath=Python
Message=A problem occurred while processing your Python script.
Here are the technical details: Access is denied
ErrorCode=-2147467259
ExceptionType=Microsoft.PowerBI.Scripting.Python.Exceptions.PythonUnexpectedException

6 REPLIES 6
ValtteriN
Super User
Super User

Hi,

Does your script works when run outside of Power BI? Also do you have credentials and permissions set up in "data source settings"?





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

Proud to be a Super User!




My script runs fine in VS code for the permissions can you guide to check it I could not find Data Source section 

UPDATE: I am using the App on Windows 10 and privacy set to none

Screenshot (3).png

Here is a good discussion about this in stackoverflow: import - "Access is denied" error while importing CSV to Power BI via Python - Stack Overflow

Basically check these things:

1. Can you access the data source on its own. Also try setting the privacy level to public.

2. Does the Python work outside PBI (you said this is okay)

3. Is the Python installed correctly from PBI's persoective





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

Proud to be a Super User!




1. Can you access the data source on its own. Also try setting the privacy level to public.
Done

2. Does the Python work outside PBI (you said this is okay)
Yes
3. Is the Python installed correctly from PBI's persoective

yes and it is set in the settings for the location of the python installtion 

Hi,

Since the issue persists even with those answers I think the problem is the python location. Going back to the stackoverflow discussion I recommend checking your path settings:

"

If none of that works, and you are using Anaconda the hardest solution is to launch the PowerBI Desktop executable from the Anaconda Prompt after activating the environment in which you want to run the Python script. The command to use to launch Power BI Desktop is as follows:

C:\Program Files\Microsoft Power BI Desktop\bin\PBIDesktop.exe

At that point PowerBI Desktop opens and, repeating the steps from before to run the sample Python code, you should be ok.

NOTE: Please ensure you add Anaconda to System Environment Variable Path list:

C:\ProgramData\Anaconda3 C:\ProgramData\Anaconda3\Scripts C:\ProgramData\Anaconda3\Library\bin

 





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

Proud to be a Super User!




My Python Installation was (is) under 

ennopommerening_0-1684754631610.png

You may have to change the locaton inside PowerBI to 

C:\Users\YOUR_USER_NAME\AppData\Local\Microsoft\WindowsApps\python

Hope this helps..

kind regards, Enno

 

Helpful resources

Announcements
PBI November 2023 Update Carousel

Power BI Monthly Update - November 2023

Check out the November 2023 Power BI update to learn about new features.

Community News

Fabric Community News unified experience

Read the latest Fabric Community announcements, including updates on Power BI, Synapse, Data Factory and Data Activator.

Dashboard in a day with date

Exclusive opportunity for Women!

Join us for a free, hands-on Microsoft workshop led by women trainers for women where you will learn how to build a Dashboard in a Day!

Power BI Fabric Summit Carousel

The largest Power BI and Fabric virtual conference

130+ sessions, 130+ speakers, Product managers, MVPs, and experts. All about Power BI and Fabric. Attend online or watch the recordings.

Top Solution Authors