Yeah, I figured that out between posts ;)<br><br>
<div class="gmail_quote">On Thu, Apr 17, 2008 at 10:39 AM, J. Cliff Dyer <<a href="mailto:jcd@unc.edu">jcd@unc.edu</a>> wrote:<br>
<blockquote class="gmail_quote" style="PADDING-LEFT: 1ex; MARGIN: 0px 0px 0px 0.8ex; BORDER-LEFT: #ccc 1px solid">
<div class="Ih2E3d">On Thu, 2008-04-17 at 09:52 -0500, Victor Subervi wrote:<br>> Never mind. Apparently, these tags throw it for that loop:<br>>   print '<html><body>\n'<br>> I´m surprised they would, but gratified I found the problem.<br>
> Victor<br>><br>><br><br></div>Why does that surprise you?  A jpeg has a well-defined header that tells<br>whatever application is rendering it what to look for.  By putting those<br>tags at the beginning of the data sent to your browser, you're no longer<br>
getting a well-formed jpeg.  The header is wrong.<br><br>As an experiment, if you're on *nix, or have access to a decent shell,<br>try this:<br><br>$ echo '<html><body>' > newfile.jpg<br>$ cat /path/to/any_normal_jpeg >> newfile.jpg<br>
$ echo '</body></html>' >> newfile.jpg<br><br>If you don't have access to a shell, open a JPEG with your favorite text<br>editor, and manually add "<html><body>" to the beginning, and save it<br>
out.<br><br>Then try to open newfile in any piece of software of your choosing.<br>It's no longer a well-formed jpeg, so it won't work.  That's exactly<br>what you're asking the browser to do.<br><br>I guess this isn't really python related, so my apologies for that.<br>
<br>Cheers,<br>Cliff<br><font color="#888888"><br><br><br><br>--<br>Oook,<br>J. Cliff Dyer<br>Carolina Digital Library and Archives<br>UNC Chapel Hill<br><br></font></blockquote></div><br>