SyntaxWarning: "\d" occurs when csv file is made, does not occur when csv file is given
17:58 11 Sep 2026

As a python newbie, I'm trying to build a website out of downloaded data. If I present a pre-made csv file containing text and numbers the script runs without error. If instead I download and convert to csv file I get the SyntaxWarning: "\d" error. Nowhere in the script does \d appear. Hear are some pieces of the puzzle:

csv file:

latitude,longitude,elevation,utc_offset_seconds,timezone,timezone_abbreviation
38.417778,-119.05176,1716.0,-25200,America/Los_Angeles,GMT-7

time,temperature_2m_max (°F),wind_speed_10m_max (mp/h)
2026-09-10,84.7,15.4
2026-09-11,83.7,21.6
2026-09-12,81.8,26.3
2026-09-13,68.5,15.2
2026-09-14,75.3,16.2
2026-09-15,77.5,12.7
2026-09-16,80.8,12.0

snippets from script:

failure:

elbowUrl = 'https://api.open-meteo.com/v1/forecast?latitude=38.42710&longitude=-119.04450&daily=temperature_2m_max,wind_speed_10m_max&timezone=America%2FLos_Angeles&wind_speed_unit=mph&temperature_unit=fahrenheit&format=csv'
response = requests.get(elbowUrl)
csv_file = response.content.decode('utf-8')

html_output = csv_to_html_table(csv_file)

success:

csv_file = 'G:/workspace/Elbow/elbowData.csv'
html_output = csv_to_html_table(csv_file)

first lines of script:

import csv
from datetime import datetime
import requests

def csv_to_html_table(csv_file_path):
    html_string = "\n    
\n" html_string += "
\n"

Note that the 2 in the last line (...mt-2) is highlighted SyntaxWarning: "\d" is triggered.

I've found no difference between the pre-made csv file and the one created in the script. What's happening and how is it fixed?

python