Biopython Entrez wanting to access /root/.config in Django app

94 views Asked by At

I have some code in a Django app which does the following, to get a Pubmed article by DOI:

def getPubmedByDOI(request,doi):
    Entrez.email = '[email protected]'
    handle = Entrez.esearch(db="pubmed", term=doi)
    record = Entrez.read(handle)
    return getPubmedArticle(request,record["IdList"][0]) // renders the article

This works nicely but for one thing - the Entrez.esearch call insists upon access to /root/.config on the server, specifically to write to the following empty directory:

/root/.config/biopython/Bio/Entrez/DTDs/

It's Apache on Gentoo, running as follows:

User django
Group apache

All the code for the application is in ~django/, so I'd expect any writing to be in ~django/.config rather than /root/.config. I can work around this by changing permissions on /root but a better solution would be to configure Biopython or Apache so as not to write to /root. Does anyone have any suggestions as to how this might be done?

1

There are 1 answers

1
Peter Cock On BEST ANSWER

Logged upstream as https://github.com/biopython/biopython/issues/918 which suggests setting:

>>> from Bio.Entrez.Parser import DataHandler
>>> DataHandler.global_dtd_dir
'/Library/Frameworks/Python.framework/Versions/2.7/lib/python2.7/site-packages/Bio/Entrez/DTDs'
>>> DataHandler.local_dtd_dir = '...'