[gdal-dev] Delete a sqlite database

Ludovic Granjon ludovic.granjon at u-bourgogne.fr
Mon Nov 29 03:23:22 EST 2010


Hello Even
Yes you are right, it works perfectly
Thanks a lot

Ludovic

Le 28/11/2010 17:23, Even Rouault a écrit :
> Le lundi 22 novembre 2010 10:26:26, Ludovic Granjon a écrit :
>> Hi all
>> I try in a python script to delete a sqlite database that I use in an
>> OGR ExecuteSQL.
>> Let me give you an example :
>>
>> If I do :
>>   >>>  from osgeo import *
>>   >>>  import os
>>   >>>  datasource = ogr.Open("decoupe.shp")
>>   >>>  layer = datasource.GetLayer()
>>   >>>  joinLayer=datasource.ExecuteSQL("SELECT decoupe.FID as ligne_id,
>>
>> c.lFid as ligne_id2, c.count as count FROM decoupe LEFT JOIN
>> 'project.sqlite'.comptage c ON decoupe.FID=c.lFid")
>>
> You probably need a datasource.ReleaseResultSet(joinLayer) at that point
>
>>   >>>  datasource.Destroy()
>>
>> It seems that there still a connection to my sqlite database and I can't
>> delete it.
>>
>> When I try on MS Windows (There's no error on linux) :
>>   >>>  os.remove('project.sqlite')
>>
>> I have :
>> Traceback (most recent call last):
>> File "<pyshell#5>", line 1, in<module>
>> os.remove('project.sqlite')
>> WindowsError: [Error 13] Le processus ne peut pas accéder au fichier car
>> ce fichier est utilisé par un autre processus: 'project.sqlite'
>>
>>
>> Do you know a way to do that ?
>>
>> Thanks
>>
>> Best regards
>>
>> Ludovic
>

-------------- next part --------------
A non-text attachment was scrubbed...
Name: ludovic_granjon.vcf
Type: text/x-vcard
Size: 156 bytes
Desc: not available
Url : http://lists.osgeo.org/pipermail/gdal-dev/attachments/20101129/cb7f3aed/ludovic_granjon.vcf


More information about the gdal-dev mailing list