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

Find everything you need to get certified on Fabric—skills challenges, live sessions, exam prep, role guidance, and more. Get started

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

7 REPLIES 7
anurag_chauhan
New Member

  1. First assuming you have installed the latest version of python.
  2.  Open command prompt then check where the python is installed by typing - where python and it will give you the path like this C:\Users\anura\AppData\Local\Microsoft\WindowsApps\python.exe
  3. Open powerbi Options and settings from the File options and click on python script, then click on browse and then go the folder where your python is installed as mentioned in step 2.

With above steps i was able to overcome the acess denied error.

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
Sept PBI Carousel

Power BI Monthly Update - September 2024

Check out the September 2024 Power BI update to learn about new features.

September Hackathon Carousel

Microsoft Fabric & AI Learning Hackathon

Learn from experts, get hands-on experience, and win awesome prizes.

Sept NL Carousel

Fabric Community Update - September 2024

Find out what's new and trending in the Fabric Community.

Top Solution Authors