I have a program which measures the similarity of all items of a set against every other item in the set. However, after 81 loops I get this error: RuntimeError: open failed (code 14) - unable to open database file - /Applications/CCDC/CSD_2017/DATA/CSD_538/Nov16_ASER.sqlite

My guess is that there is no room in the temporary files folder to store the data but the source code gives the impression that it deletes temporary databases once they have been used. I've tried to use garbage collector and only the readers when I run the function to make the search (I'm assuming they close once the function finishes) but this has only slightly increased the number of loops before the error occurs. I have ran the program on just the entries that it breaks on to see if there are some corrupted filed however they worked fine.

 

Is this a common issue? Currently it breaks after 81 similarity searches

 Hi Bagnall,

Depending on your operating system, there is a limit to how many open connections can be held on the database file.  It looks like you are hitting this limit.

If I understand your goal correctly, use of the search_molecule() method might be a better approach. Assuming that your molecules are stored in a list named molecules:

for i in molecules:
ss = SimilaritySearch(i)
for j in molecules:
hit = ss.search_molecule(j)

I don't believe this will cause the problem you see as it never access the database.

Does that resolve your issue?

Stewart.

Hi Steward,

Thanks for getting back to me

I'm currently storing a list of entry names, would I need to make read them into the molecule reader before trying this?

Alex

Hi,

Yes, I think you would need to do this. If your names are the CSD refcodes and they are stored in list_of_refcodes, it can be achieved with:

reader = MoleculeReader()
molecules = [reader.molecule(refcode) for refcode in list_of_refcodes]

I hope that helps,

Stewart.

Hi Stewart,

This has solved my issue. Thank you for all the help it has improved the programs memory use as well as running to completion.

Alex

You must be signed in to post in this forum.