<?xml version="1.0" encoding="UTF-8"?>
<rss xmlns:content="http://purl.org/rss/1.0/modules/content/" xmlns:dc="http://purl.org/dc/elements/1.1/" xmlns:rdf="http://www.w3.org/1999/02/22-rdf-syntax-ns#" xmlns:taxo="http://purl.org/rss/1.0/modules/taxonomy/" version="2.0">
  <channel>
    <title>topic Python script not allowing me to schedule refresh in Developer</title>
    <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791828#M50985</link>
    <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Power BI report built from a dataflow (that I don't have admin access to). Within Power Query, I have applied a script to one of the tables from this flow. I have then published it to Power BI Service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting the below error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harlanpost_0-1711465942331.png" style="width: 528px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1067141iC42EE5822FA7674C/image-dimensions/528x70?v=v2" width="528" height="70" role="button" title="harlanpost_0-1711465942331.png" alt="harlanpost_0-1711465942331.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As such, I suspect the issue is related to my Python script. I have a couple of questions:&lt;BR /&gt;&lt;BR /&gt;1) Why can I not refresh the report in Power BI Service with this script?&lt;/P&gt;&lt;P&gt;2) Are there any workarounds I could use to avoid this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll leave the Python script below in case anybody has any insights. The script works perfectly when executed in Power Query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
import re
from datetime import datetime

def extract_and_standardize_date(text):
    if pd.isna(text) or text.strip() == '':
        return None

    date_pattern = r'\b(0?[1-9]|[12][0-9]|3[01])[-/. ](0?[1-9]|1[012]|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:[-/. ](\d{2}|\d{4}))?\b'
    match = re.search(date_pattern, text, re.IGNORECASE)

    if match:
        groups = match.groups()
        day = groups[0]
        month = groups[1]
        year = groups[2] if groups[2] else str(datetime.now().year)  # Use current year if year is missing

        if month.isalpha():
            datetime_object = datetime.strptime(month, "%b")
            month = datetime_object.month

        if len(year) == 2:
            year = '20' + year

        return f"{day.zfill(2)}/{str(month).zfill(2)}/{year}"

    return None



dataset['standardized_date'] = dataset['Column_X'].apply(extract_and_standardize_date)

dataset&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
    <pubDate>Tue, 26 Mar 2024 15:16:58 GMT</pubDate>
    <dc:creator>harlanpost</dc:creator>
    <dc:date>2024-03-26T15:16:58Z</dc:date>
    <item>
      <title>Python script not allowing me to schedule refresh</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791828#M50985</link>
      <description>&lt;P&gt;Hi all,&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I have a Power BI report built from a dataflow (that I don't have admin access to). Within Power Query, I have applied a script to one of the tables from this flow. I have then published it to Power BI Service.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I am getting the below error:&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harlanpost_0-1711465942331.png" style="width: 528px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1067141iC42EE5822FA7674C/image-dimensions/528x70?v=v2" width="528" height="70" role="button" title="harlanpost_0-1711465942331.png" alt="harlanpost_0-1711465942331.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;As such, I suspect the issue is related to my Python script. I have a couple of questions:&lt;BR /&gt;&lt;BR /&gt;1) Why can I not refresh the report in Power BI Service with this script?&lt;/P&gt;&lt;P&gt;2) Are there any workarounds I could use to avoid this?&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I'll leave the Python script below in case anybody has any insights. The script works perfectly when executed in Power Query.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;Thank you in advance for the help!&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;LI-CODE lang="python"&gt;import pandas as pd
import re
from datetime import datetime

def extract_and_standardize_date(text):
    if pd.isna(text) or text.strip() == '':
        return None

    date_pattern = r'\b(0?[1-9]|[12][0-9]|3[01])[-/. ](0?[1-9]|1[012]|Jan|Feb|Mar|Apr|May|Jun|Jul|Aug|Sep|Oct|Nov|Dec)(?:[-/. ](\d{2}|\d{4}))?\b'
    match = re.search(date_pattern, text, re.IGNORECASE)

    if match:
        groups = match.groups()
        day = groups[0]
        month = groups[1]
        year = groups[2] if groups[2] else str(datetime.now().year)  # Use current year if year is missing

        if month.isalpha():
            datetime_object = datetime.strptime(month, "%b")
            month = datetime_object.month

        if len(year) == 2:
            year = '20' + year

        return f"{day.zfill(2)}/{str(month).zfill(2)}/{year}"

    return None



dataset['standardized_date'] = dataset['Column_X'].apply(extract_and_standardize_date)

dataset&lt;/LI-CODE&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 15:16:58 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791828#M50985</guid>
      <dc:creator>harlanpost</dc:creator>
      <dc:date>2024-03-26T15:16:58Z</dc:date>
    </item>
    <item>
      <title>Re: Python script not allowing me to schedule refresh</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791902#M50987</link>
      <description>&lt;P&gt;Python and R scripts and visuals&amp;nbsp;&lt;STRONG&gt;mandate&lt;/STRONG&gt; the use of a &lt;STRONG&gt;personal&lt;/STRONG&gt; gateway.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 15:57:41 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791902#M50987</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-26T15:57:41Z</dc:date>
    </item>
    <item>
      <title>Re: Python script not allowing me to schedule refresh</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791992#M50989</link>
      <description>&lt;P&gt;Thanks for the response.&lt;/P&gt;&lt;P&gt;&amp;nbsp;&lt;/P&gt;&lt;P&gt;I don't seem to have the ability to create a personal gateway.&amp;nbsp;&lt;/P&gt;&lt;P&gt;&lt;span class="lia-inline-image-display-wrapper lia-image-align-inline" image-alt="harlanpost_0-1711472632854.png" style="width: 400px;"&gt;&lt;img src="https://community.fabric.microsoft.com/t5/image/serverpage/image-id/1067200i02722F3B1301ACEB/image-size/medium?v=v2&amp;amp;px=400" role="button" title="harlanpost_0-1711472632854.png" alt="harlanpost_0-1711472632854.png" /&gt;&lt;/span&gt;&lt;/P&gt;&lt;P&gt;Could this be a result of the fact I'm using a dataflow?&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:04:29 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3791992#M50989</guid>
      <dc:creator>harlanpost</dc:creator>
      <dc:date>2024-03-26T17:04:29Z</dc:date>
    </item>
    <item>
      <title>Re: Python script not allowing me to schedule refresh</title>
      <link>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3792001#M50990</link>
      <description>&lt;P&gt;You need to do things the other way round.&amp;nbsp; First install and run the personal gateway and then use it in a dataflow.&lt;/P&gt;</description>
      <pubDate>Tue, 26 Mar 2024 17:09:15 GMT</pubDate>
      <guid>https://community.fabric.microsoft.com/t5/Developer/Python-script-not-allowing-me-to-schedule-refresh/m-p/3792001#M50990</guid>
      <dc:creator>lbendlin</dc:creator>
      <dc:date>2024-03-26T17:09:15Z</dc:date>
    </item>
  </channel>
</rss>

