<HTML><BODY style="word-wrap: break-word; -khtml-nbsp-mode: space; -khtml-line-break: after-white-space; "><BR><DIV><DIV>On May 31, 2007, at 8:08 PM, Sick Monkey wrote:</DIV><BR class="Apple-interchange-newline"><BLOCKQUOTE type="cite"><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">I ran into another slight problem.  And I attempted to fix it, but have not been able to do so yet.  If a filename does not contain a space, then this method works like a charm.  But if there is a space then the code throws a nasty error.<SPAN class="Apple-converted-space"> </SPAN><BR><BR>import os<BR>import subprocess<BR>from os import *<BR>imagefile = "/somedir/images/david.huggins/Photo 1.jpg"<BR>cmdw = "identify -format %w '"+imagefile+"'"<BR>cmdh = "identify -format %h '"+imagefile+"'"<SPAN class="Apple-converted-space"> </SPAN><BR>pw = subprocess.Popen(cmdw.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)<BR>ph = subprocess.Popen(cmdh.split(), stdout=subprocess.PIPE, stderr=subprocess.STDOUT)<BR>w = pw.stdout.read().strip()<BR>h = ph.stdout.read ().strip()<BR><BR>------------<BR>identify: Unable to open file ('/somedir/images/david.huggins/Photo) [No such file or directory].<BR>identify: Unable to open file (1.jpg') [No such file or directory].<BR>identify: Missing an image file name [No such file or directory].<SPAN class="Apple-converted-space"> </SPAN><BR>identify: Unable to open file ('/somedir/images/david.huggins/Photo) [No such file or directory].<BR>identify: Unable to open file (1.jpg') [No such file or directory].<BR>identify: Missing an image file name [No such file or directory].<SPAN class="Apple-converted-space"> </SPAN><BR>Traceback (most recent call last):<BR></SPAN></BLOCKQUOTE></DIV><BR><DIV> <SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">T<SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; ">ry inserting a backslash before the space:</SPAN></SPAN></SPAN></SPAN></DIV><DIV><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><SPAN class="Apple-style-span" style="border-collapse: separate; border-spacing: 0px 0px; color: rgb(0, 0, 0); font-family: Monaco; font-size: 13px; font-style: normal; font-variant: normal; font-weight: normal; letter-spacing: normal; line-height: normal; text-align: auto; -khtml-text-decorations-in-effect: none; text-indent: 0px; -apple-text-size-adjust: auto; text-transform: none; orphans: 2; white-space: normal; widows: 2; word-spacing: 0px; "><DIV style="font-family: Helvetica; font-size: 12px; "><BR class="khtml-block-placeholder"></DIV><DIV style="font-family: Helvetica; font-size: 12px; ">imagefile = imagefile.replace(' ', '\ ')</DIV><DIV style="font-family: Helvetica; font-size: 12px; "><BR class="khtml-block-placeholder"></DIV><DIV style="font-family: Helvetica; font-size: 12px; ">hth,</DIV><DIV style="font-family: Helvetica; font-size: 12px; ">Michael</DIV><DIV style="font-family: Helvetica; font-size: 12px; "><BR class="khtml-block-placeholder"></DIV><DIV style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">---</SPAN></SPAN></SPAN></SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ; font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">The Rules of Optimization are simple.</SPAN></SPAN></SPAN></SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ; font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">Rule 1: Don't do it.</SPAN></SPAN></SPAN></SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ; font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">Rule 2 (for experts only): Don't do it yet.</SPAN></SPAN></SPAN></SPAN></DIV><DIV style="margin-top: 0px; margin-right: 0px; margin-bottom: 0px; margin-left: 0px; ; font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; "><SPAN class="Apple-style-span" style="font-family: Helvetica; font-size: 12px; ">                                 -Michael A. Jackson</SPAN></SPAN></SPAN></SPAN></DIV><BR class="Apple-interchange-newline"></SPAN></SPAN></SPAN></SPAN><BR class="khtml-block-placeholder"> </DIV><BR></BODY></HTML>