Join us at FabCon Atlanta from March 16 - 20, 2026, for the ultimate Fabric, Power BI, AI and SQL community-led event. Save $200 with code FABCOMM.
Register now!The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now! Learn more
I am trying to create a real time report from the following website.
The website updates data every hour by generating a new .zip file at the bottom of the list.
The difficulty is twofold:
I have written the following python script to download the latest report which works when I run it in the Command Prompt:
import requests
import os
import pandas as pd
from bs4 import BeautifulSoup
from urllib.request import urlopen
from io import BytesIO
from zipfile import ZipFile
# important addresses
parent_dir = "http://www.nemweb.com.au"
URL = "http://www.nemweb.com.au/REPORTS/CURRENT/Short_Term_PASA_Reports/"
dest_dir = "D:\Python\DELWP"
# web scraping
page = requests.get(URL)
soup = BeautifulSoup(page.content, "html.parser")
zip_reports = soup.find_all("a")
report_link = parent_dir + zip_reports[-1].get("href")
resp = urlopen(report_link)
# extracting zip file and converting it to dataframe
zip_file = ZipFile(BytesIO(resp.read()))
fname = zip_file.namelist()[0]
df = pd.read_csv(zip_file.open(fname), skiprows=3, dtype=object)
zip_file.close()
print(df)
However, it doesn't work when I execute it from Python Script in PowerBI.
I get the following error:
python error
I have set the Python Home directory to the same address that I get when I type where python in the command prompt.
home directory
execution and location
Can someone help, please?
PS: The solutions proposed by the responses in this community message don't work because they treat the url address as permanent.
Solved! Go to Solution.
OK. I solved the problem. It was a matter of reinstalling a few packages.
I did the following:
Cheers
OK. I solved the problem. It was a matter of reinstalling a few packages.
I did the following:
Cheers
The Power BI Data Visualization World Championships is back! Get ahead of the game and start preparing now!
| User | Count |
|---|---|
| 3 | |
| 2 | |
| 1 | |
| 1 | |
| 1 |
| User | Count |
|---|---|
| 11 | |
| 7 | |
| 4 | |
| 3 | |
| 3 |