#1
  1. No Profile Picture
    inexperienced and useless
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Stevenage, uk
    Posts
    10
    Rep Power
    0

    Angry embedded html causing problems


    I'm writing a cgi with python at the minute and I seem to be getting some very strange errors from the embedded html.

    I get ValueErrors for unsupported format character ' " ' at index 266

    I have checked through my code and find myself unable to see what could be causing this error, as there are no ' " ' out of place.

    If you can help I would greatly appreciate it.

    Thanks
  2. #2
  3. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    13
    What do you mean with embedded HTML? You're using ASP+Python and <% + %> tags? Or are you just using the print statement?
    Could you also post some code fro your script where you get your error?
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs
  4. #3
  5. No Profile Picture
    inexperienced and useless
    Devshed Newbie (0 - 499 posts)

    Join Date
    Aug 2001
    Location
    Stevenage, uk
    Posts
    10
    Rep Power
    0
    Yeah sorry about that, I'm using %s and the html is actually within a cgi script as a variable, which can then be printed and the %s variables be defined.

    Here's the html of the script:

    <table bgcolor="#FFb573" width="65%" border="0" cellpadding="5" cellspacing="0">

    <tr>
    <td>mudid: </td>
    <td>
    <input type=text name=mudid>
    </td>
    </tr>
    <tr>
    <td>Server:<select "Server: " name="Server" align=left>
    %s <!--Server list-->
    </select></td>
    <td>Database:<select name="Database" align=left>
    %s <!--Database List-->
    </select></td>
    </tr>
    <tr>
    <td>search type: </td>
    <td>substructure:
    <input type=radio name=searchtype value=substrusture>
    string:
    <input type=radio name=searchtype value=string>
    superstructure:
    <input type=radio name=searchtype value=superstructure>
    </td>
    </tr>
    <tr>
    <td>smiles: </td>
    <td>
    <input type=text name=smi>
    </td>
    </tr>
    <tr>
    <td colspan=2><input type=hidden name=mol_inline><embed type="chemical/x-mdl-molfile" width=300 height=250 bgcolor=#ffffff queryformbox="document.qbuild.mol_inline">
    </td>

    </tr>
    <tr>
    <td>smiles or structure: </td>
    <td>smiles:
    <input type=radio value=strucorsmiles name=smiles>
    structure:
    <input type=radio value=strucorsmiles name=structure>
    </td>
    </tr>
    </table>
    </td></tr>
    </table>

    not really sure what could be causing the errors.
    Thanks
  6. #4
  7. No Profile Picture
    Python Prophet
    Devshed Newbie (0 - 499 posts)

    Join Date
    Jun 2001
    Location
    Amersfoort, The Netherlands
    Posts
    45
    Rep Power
    13
    I see the problem, you're using this code: 65%". Python thinks the % starts the format specifier, and then it reports " is an illegal format character. You should replace all % that are not used for formatting with %%.

    http://python.sourceforge.net/devel-...q-strings.html
    Some people, when confronted with a problem, think I know, I'll use regular expressions. Now they have two problems. - Jamie Zawinski, in comp.lang.emacs

IMN logo majestic logo threadwatch logo seochat tools logo