No errors on screen (even with msg suppression commented out) but not working on IIS server. Works on laptop Apache server, works on VSC extension, “hello world” example works on IIS server, but not below code. Appreciate any thoughts.
index.html
<!DOCTYPE html>
<html lang="en">
<head>
<meta charset="utf-8">
<meta name="viewport" content="width=device-width, initial-scale=1">
<title>NAP Rater</title>
<link rel="icon" type="image/x-icon" href="img/favicon.ico">
<link rel="stylesheet" href="https://pyscript.net/releases/2024.10.2/core.css">
<script type="module" src="https://pyscript.net/releases/2024.10.2/core.js"></script>
<link rel="stylesheet" href="css/styles.css">
</head>
<body>
<h1>Test</h1>
<h2>Test1</h2>
<table>
<tr>
<td>
Class Code:
</td>
<td>
<datalist id="classsuggestions">
</datalist>
<input autoComplete="on" list="classsuggestions" name="classcode" id="classcode"
style="width: 500px;" />
</td>
</tr>
<tr>
<td>
Zip Code:
</td>
<td>
<input name="zipcode" id="zipcode" placeholder="XXXXX" style="width: 500px;" />
</td>
</tr>
<tr>
<td>
<label for="limit">Limits:</label>
</td>
<td>
<select name="limit" id="limit" style="width: 500px;">
<option value="1O2A">$1,000,000 / $2,000,000</option>
<option value="2O4A">$2,000,000 / $4,000,000</option>
</select>
</td>
</tr>
<tr>
<td>
<label for="deductible">Deductible:</label>
</td>
<td>
<select name="deductible" id="deductible" style="width: 500px;">
<option value="0k">$0</option>
<option value="5k">$5,000</option>
<option value="10k">$10,000</option>
<option value="15k">$15,000</option>
<option value="20k">$20,000</option>
<option value="25k">$25,000</option>
</select>
</td>
</tr>
<tr>
<td>
Permissable:
</td>
<td>
<input name="permissable" id="permissable" placeholder="XX" style="width: 475px;" /><b>%</b>
</td>
</tr>
</table>
<p><button py-click="getrate">Get Rate Data</button></p>
<table>
<tr>
<td>Premium Basis:</td>
<td><input name="basis" id="basis" readonly="readonly" style="width: 500px;" /></td>
</tr>
<tr>
<td>CGL Rate:</td>
<td><input name="glrate" id="glrate" readonly="readonly" style="width: 230px;" /> per <input name="rateper" id="rateper" readonly="readonly" style="width: 230px;" /></td>
</tr>
<tr>
<td>Exposure Amount:</td>
<td><input name="exposure" id="exposure" style="width: 500px;" /></td>
</tr>
</table>
<p><button py-click="getpremium">Rate Policy</button></p>
<P>
Premium: <input name="ratedpremium" id="ratedpremium" readonly="readonly" style="width: 500px;" />
</P>
<p>
<div id="readystatus" class="statmsg"></div>
<div id="lookupstatus" class="statmsg"></div>
<div id="ratestatus" class="statmsg"></div>
</p>
<!-- <script src="js/scripts.js"></script>-->
<script type="py" src="main.py" config="pyscript.toml"></script>
</body>
</html>
main.py
import warnings
warnings.filterwarnings('ignore')
import js
import pandas as pd
from pyscript import document
#def loadme(event):
df = pd.read_excel('lookups.xlsx', sheet_name='Table 0')
mylist2 = df['Concat'].tolist()
dl = js.document.getElementById("classsuggestions")
for option in mylist2:
option_element = js.document.createElement("option")
option_element.value = option
dl.appendChild(option_element)
status1 = document.querySelector("#readystatus")
status1.innerText = "Ready"
def getrate(event):
ziplookup = document.querySelector("#zipcode")
zipvalue = ziplookup.value
df0 = pd.read_excel('lookups.xlsx', sheet_name='zipcodes')
xlskey = df0.loc[df0['zipcode'] == int(zipvalue), 'sheet'].values[0]
terkey = df0.loc[df0['zipcode'] == int(zipvalue), 'territory'].values[0]
inlookup = document.querySelector("#classcode")
invalue = inlookup.value
df2 = pd.read_excel('lookups.xlsx', sheet_name='Table 0')
ovalue1 = df2.loc[df2['Concat'] == invalue, 'basis'].values[0]
rateper = df2.loc[df2['Concat'] == invalue, 'per'].values[0]
cglclass = df2.loc[df2['Concat'] == invalue, 'General Liability Code'].values[0]
myurl = f"{xlskey}.xlsx"
df3 = pd.read_excel(myurl, sheet_name=terkey)
ovalue2 = df3.loc[df3['Class'] == int(cglclass), 'Rate'].values[0]
olookup1 = document.querySelector("#basis")
olookup2 = document.querySelector("#glrate")
olookup3 = document.querySelector("#rateper")
olookup1.value = ovalue1
olookup2.value = ovalue2
olookup3.value = rateper
ocontent3 = document.querySelector("#lookupstatus")
ocontent3.innerText = "Rate Found"
def getpremium(event):
icontent1 = document.querySelector("#glrate")
icontenta = icontent1.value
icontent2 = document.querySelector("#rateper")
icontentb = icontent2.value
icontent3 = document.querySelector("#exposure")
icontentc = icontent3.value
icontent4 = document.querySelector("#permissable")
icontentd = icontent4.value
icontent = (int(icontenta) * (int(icontentc)/int(icontentb))) / (float(icontentd)/100)
ocontent = document.querySelector("#ratedpremium")
ocontent.value = icontent
ocontent2 = document.querySelector("#ratestatus")
ocontent2.innerText = "Policy Rated"
pyscript.toml
packages = ["pandas", "openpyxl"]
[[fetch]]
from = "xlsx/lookups.xlsx"
[[fetch]]
from = "xlsx/A.xlsx"
[[fetch]]
from = "xlsx/B.xlsx"
[[fetch]]
from = "xlsx/C.xlsx"