enasequence / enaBrowserTools

A collection of scripts to assist in the retrieval of data from the ENA Browser
Apache License 2.0
74 stars 15 forks source link

FileNotFoundError for temp.txt #45

Closed sweramesh closed 4 years ago

sweramesh commented 4 years ago

I am using Snakemake and enaDataGet to download several fastq files concurrently from a project (namely PRJEB9586) instead of using enaGroupGet. However I get the following error:

FileNotFoundError: [Errno 2] No such file or directory: 'PRJEB9586/temp.txt'

I believe this is the block of code from python3/readGet.py that messes things up:

temp_file = os.path.join(dest_dir, 'temp.txt')
utils.download_report_from_portal(search_url, temp_file)
f = open(temp_file)
lines = f.readlines()
f.close()
os.remove(temp_file)

Because my Snakemake pipeline is running concurrently, there are several processes creating and deleting this temp.txt file, which is causing the error. Can this be fixed, possibly by using Python's tempfile library?

suranjayathilaka commented 4 years ago

Thanks for using enaBrowserTools. Changed to not use temp files in this context. Let me know if you face any problems.