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

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more

Reply
jaryszek
Memorable Member
Memorable Member

Trying to avoid formula:firewall error using python script

Hi Guys,

i have the code like here:

= fnGetPath("BUNDLES_PATH_TEST")


- this is my function with argument refrencing to windows environment.

Function is:

let
    GetPath = (envVariable as text) =>
    let
        Source = Python.Execute("
import os
import pandas as pd

env_value = os.getenv(envVariable)

data = [[env_value]]
df = pd.DataFrame(data, columns=['Path'])
"),
        df1 = Source{[Name="df"]}[Value],
        Path = df1{0}[Path]
    in
        Path
in
    GetPath


without function is working. 
But I am getting formula:firewall issue. 

So i need to have a function but seems that power query is not consuming my passed argument as text...

Please help,
Jacek

1 ACCEPTED SOLUTION
bhanu_gautam
Super User
Super User

@jaryszek , Try using

let
GetPath = (envVariable as text) =>
let
Source = Python.Execute("
import os
import pandas as pd

env_value = os.getenv('" & envVariable & "')

data = [[env_value]]
df = pd.DataFrame(data, columns=['Path'])
"),
df1 = Source{[Name="df"]}[Value],
Path = df1[Path]
in
Path
in
GetPath




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






View solution in original post

2 REPLIES 2
bhanu_gautam
Super User
Super User

@jaryszek , Try using

let
GetPath = (envVariable as text) =>
let
Source = Python.Execute("
import os
import pandas as pd

env_value = os.getenv('" & envVariable & "')

data = [[env_value]]
df = pd.DataFrame(data, columns=['Path'])
"),
df1 = Source{[Name="df"]}[Value],
Path = df1[Path]
in
Path
in
GetPath




Did I answer your question? Mark my post as a solution! And Kudos are appreciated

Proud to be a Super User!




LinkedIn






It worked! thanks. 

Unfortunately still formula:firewall error is there...

Best,
Jacek

Helpful resources

Announcements
Power BI DataViz World Championships

Power BI Dataviz World Championships

The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!

December 2025 Power BI Update Carousel

Power BI Monthly Update - December 2025

Check out the December 2025 Power BI Holiday Recap!

FabCon Atlanta 2026 carousel

FabCon Atlanta 2026

Join us at FabCon Atlanta, March 16-20, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.

Top Solution Authors