this patch is only for to fix the error, not to refactor the code.<br><br>i tried to change the code as minimum as possible. <br><br>os.path.join(Path, Filename) is more appropriate, but if the code is working without using proper built-in function,<br>
<br>that is also fine for me.<br><br>volkan.<br><br><div class="gmail_quote">On Thu, Jun 4, 2009 at 1:55 PM, Barry Rowlingson <span dir="ltr">&lt;<a href="mailto:b.rowlingson@lancaster.ac.uk">b.rowlingson@lancaster.ac.uk</a>&gt;</span> wrote:<br>
<blockquote class="gmail_quote" style="border-left: 1px solid rgb(204, 204, 204); margin: 0pt 0pt 0pt 0.8ex; padding-left: 1ex;">&gt;         srcPath += &#39;/&#39; + srcName<br>
<div class="im"><br>
&gt;     if self.writeToShp(tmpDir+&#39;/&#39;+srcName+&#39;.shp&#39;, self.provider.encoding())<br>
<br>
</div><div class="im">&gt;       QgsVectorFileWriter.deleteShapeFile(tmpDir+&#39;/&#39;+srcName+&#39;.shp&#39;)<br>
<br>
</div>&gt;     QFile(srcPath+&#39;.dbf~&#39;).remove()<br>
<div class="im"><br>
&gt;     if not QFile(srcPath+&#39;.dbf&#39;).rename(srcPath+&#39;.dbf~&#39;):<br>
<br>
</div><div class="im">&gt;       QgsVectorFileWriter.deleteShapeFile(tmpDir+&#39;/&#39;+srcName+&#39;.shp&#39;)<br>
<br>
</div><div class="im">&gt;     shutil.copy(tmpDir+&#39;/&#39;+srcName+&#39;.dbf&#39;, srcPath+&#39;.dbf&#39;)<br>
&gt;     QFile(srcPath+&#39;.dbf~&#39;).remove()<br>
<br>
</div> ouch ouch ouch!<br>
<br>
 If you need to do file path manipulation in python then it&#39;s<br>
generally better to use functions from the os.path module - it handles<br>
OS-specific things like / and \, splitting dir/filename from paths,<br>
creating canonical paths, resolving symlinks (if your OS supports it)<br>
and all that.<br>
<br>
 Note that os.path tends to fail if you feed it QStrings, so convert<br>
to python strings beforehand, or maybe use methods from QDir -<br>
actually, that&#39;s probably a better idea! QDir has methods for these<br>
sort of things too. Concatenating strings for files, especially adding<br>
slashes or backslashes, can get painful when you go across platforms.<br>
<font color="#888888"><br>
Barry<br>
</font></blockquote></div><br><br clear="all">