My impression was that Mike had a whole lot of files such as leave_empty1.text, leave_empty2.txt, leave_empty3.txt, which should all match the pattern leave_empty*.*<div><br></div><div><br></div><div>Cheers,</div><div>-T<br>
<br><div class="gmail_quote">On Thu, Oct 15, 2009 at 8:06 PM, raf <span dir="ltr">&lt;<a href="mailto:raf@raf.org">raf@raf.org</a>&gt;</span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex;">
<div class="im">Mike Dewhirst wrote:<br>
<br>
&gt; The problem I find is that Python seems to be using the wrong default<br>
&gt; path separator here ...<br>
&gt;<br>
&gt; &#39;C:\\users\\miked\\py\\chemdata\\src\\getmsds\\testlinks\\leave_empty/*.*&#39;<br>
&gt;<br>
&gt; ... and which line can be seen below in context as part of the traceback.<br>
&gt;<br>
&gt; I&#39;m sure Windows did not add the /*.* and I certainly didn&#39;t. That<br>
&gt; leaves Python as the obvious suspect.<br>
&gt;<br>
&gt; Any clues appreciated<br>
&gt;<br>
&gt; Thanks<br>
&gt; Mike<br>
<br>
</div>hi,<br>
<br>
forward slash works fine on windows.<br>
i don&#39;t think that&#39;s the problem.<br>
does the leave_empty directory actually exist?<br>
that might be the problem. i can&#39;t see mkdir<br>
anywhere in the code.<br>
<br>
cheers,<br>
<font color="#888888">raf<br>
</font><div><div></div><div class="h5"><br>
&gt; --- code being tested on Windows XP with Python 2.6 ---<br>
&gt;<br>
&gt; class GetBase(object):<br>
&gt;<br>
&gt;     def __init__(self, basedir=basedir, ext=ext):<br>
&gt;         self.basedir = basedir<br>
&gt;         self.ext = ext<br>
&gt;<br>
&gt;     def filelist(self):<br>
&gt;         # return list of (ccode, filename) tuples<br>
&gt;         filelist = os.listdir(self.basedir)<br>
&gt;         retlist = []<br>
&gt;         for item in filelist:<br>
&gt;             if self.ext in item:<br>
&gt;                 (ccode, toss) = item.split(&quot;_&quot;, 1)<br>
&gt;                 retlist.append((ccode, item))<br>
&gt;         return retlist<br>
&gt;<br>
&gt;<br>
&gt; --- tests.py excerpt ---<br>
&gt;<br>
&gt; import os, unittest<br>
&gt; import sds<br>
&gt;<br>
&gt; emptydir = &#39;leave_empty&#39;<br>
&gt; testdir = os.getcwd() + os.path.sep + &#39;testlinks&#39;<br>
&gt;<br>
&gt; class test_sds(unittest.TestCase):<br>
&gt;<br>
&gt;     def test_files_not_exist(self):<br>
&gt;         &quot;&quot;&quot; 1 &quot;&quot;&quot;<br>
&gt;         filesdir = testdir + os.path.sep + emptydir<br>
&gt;         print(filesdir)<br>
&gt;         tsto = sds.GetBase(filesdir)<br>
&gt;         numf = len(tsto.filelist())<br>
&gt;         print(&#39;%s&#39; % numf)<br>
&gt;         self.assertEqual(numf == 0, True)<br>
&gt;<br>
&gt; --- error ---<br>
&gt;<br>
&gt; Traceback (most recent call last):<br>
&gt;   File &quot;tests.py&quot;, line 85, in test_files_not_exist<br>
&gt;     numf = len(tsto.filelist())<br>
&gt;   File &quot;C:\users\miked\py\chemdata\src\getmsds\sds.py&quot;, line 39, in<br>
&gt; filelist<br>
&gt;     filelist = os.listdir(self.basedir)<br>
&gt; WindowsError: [Error 3] The system cannot find the path specified:<br>
&gt; &#39;C:\\users\\miked\\py\\chemdata\\src\\getmsds\\testlinks\\leave_empty/*.*&#39;<br>
&gt;<br>
&gt;<br>
&gt;<br>
&gt; _______________________________________________<br>
&gt; python-au maillist  -  <a href="mailto:python-au@starship.python.net">python-au@starship.python.net</a><br>
&gt; <a href="http://starship.python.net/mailman/listinfo/python-au" target="_blank">http://starship.python.net/mailman/listinfo/python-au</a><br>
<br>
_______________________________________________<br>
python-au maillist  -  <a href="mailto:python-au@starship.python.net">python-au@starship.python.net</a><br>
<a href="http://starship.python.net/mailman/listinfo/python-au" target="_blank">http://starship.python.net/mailman/listinfo/python-au</a><br>
</div></div></blockquote></div><br><br clear="all"><br>-- <br>--------------------------------------------------<br>Tennessee Leeuwenburg<br><a href="http://myownhat.blogspot.com/">http://myownhat.blogspot.com/</a><br>&quot;Don&#39;t believe everything you think&quot;<br>

</div>