Forum Discussion
Anonymous
7 years agoNot applicable
Python script error in Power Query Editor PythonUnexpectedException
Hello, I'm working on a Power BI report. I have multiple queries in the Power Query Editor including Python scripts. Suddenly some scripts that did work previously, now give the following error: ...
- 7 years ago
Hi Anonymous ,
From the Data Source Settings dialog, select the data source(s) and then select Edit Permissions... and ensure that the Privacy Level is set to Public.

v-frfei-msft
7 years agoCommunity Support
Hi Anonymous ,
From the Data Source Settings dialog, select the data source(s) and then select Edit Permissions... and ensure that the Privacy Level is set to Public.

Anonymous
6 years agoNot applicable
I met this same problem but can fix by solution here.
my code:
import re
hours_lst = []
for s in zip(dataset['timeSpent']):
p = re.compile("(?P<day>\d+d)?\s*(?P<hour>\d+h)?\s*(?P<minute>\d+m)?")
m = re.search(p, str(s))
day = m.group('day')
day = re.findall("\d+", day)[0] if day else 0
hour = m.group('hour')
hour = re.findall("\d+", hour)[0] if hour else 0
minute = m.group('minute')
minute = re.findall("\d+", minute)[0] if minute else 0
hours = 8*int(day) + int(hour) + float(minute)/60
hours_lst.append(0)
dataset['hours'] = hours_lst