arq5x / poretools

a toolkit for working with Oxford nanopore data
MIT License
239 stars 90 forks source link

More intelligent tmpdirs. #49

Open arq5x opened 9 years ago

arq5x commented 9 years ago

Hello,

I got this error when running poretools twice simultaneously:

OSError: [Errno 39] Directory not empty: '.poretools_tmp/H566_ON_inc'

It would be useful to fix this, and I guess it could be done by using tempfile.mkdtemp, instead of the static name '.poretools_tmp'.

I hope that helps. Have a nice day, Martin Frith

P.S. Full error message:

Traceback (most recent call last): File "/usr/local/bin/poretools", line 9, in load_entry_point('poretools==0.5.1', 'console_scripts', 'poretools')() File "/usr/local/lib/python2.7/dist-packages/poretools-0.5.1-py2.7.egg/poretools/poretools_main.py", line 401, in main args.func(parser, args) File "/usr/local/lib/python2.7/dist-packages/poretools-0.5.1-py2.7.egg/poretools/poretools_main.py", line 47, in run_subtool submodule.run(parser, args) File "/usr/local/lib/python2.7/dist-packages/poretools-0.5.1-py2.7.egg/poretools/fastq.py", line 6, in run for fast5 in Fast5File.Fast5FileSet(args.files): File "/usr/local/lib/python2.7/dist-packages/poretools-0.5.1-py2.7.egg/poretools/Fast5File.py", line 36, in init self._extract_fast5_files() File "/usr/local/lib/python2.7/dist-packages/poretools-0.5.1-py2.7.egg/poretools/Fast5File.py", line 81, in _extract_fast5_files shutil.rmtree(PORETOOLS_TMPDIR) File "/usr/lib/python2.7/shutil.py", line 247, in rmtree rmtree(fullname, ignore_errors, onerror) File "/usr/lib/python2.7/shutil.py", line 256, in rmtree onerror(os.rmdir, path, sys.exc_info()) File "/usr/lib/python2.7/shutil.py", line 254, in rmtree os.rmdir(path) OSError: [Errno 39] Directory not empty: '.poretools_tmp/H566_ON_inc'

duncanparkes commented 7 years ago

If #87 could be solved by opening fast5 files from a tar archive without writing them to disk, that would solve this issue too.

I like the idea of using mkdtemp above. Another possibility would be to let poretools take an argument (or look at an environment variable) to decide where to put the temporary directory.