lgautier/fastq-and-furious

Error importing libraries as written in README

evanbiederstedt opened this issue · 4 comments

I installed the library as follows

pip install git+https://github.com/lgautier/fastq-and-furious.git

using Python 3.7.3

>>> import sys
>>> print(sys.version)
3.7.3 (default, Sep  5 2019, 17:14:41) 
[Clang 11.0.0 (clang-1100.0.33.8)]

This is the example code snippet in the README:

from fastqandfurious import fastqandfurious, entryfunc

bufsize = 20000
with open("a/fastq/file.fq") as fh:
    it = fastqandfurious.readfastq_iter(fh, bufsize, entryfunc)
    for sequence in it:
        # do something
	pass

I get the following error importing the libraries:

>>> from fastqandfurious import fastqandfurious, entryfunc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'entryfunc' from 'fastqandfurious' (unknown location)
>>> 

The following does work though:

>>> from fastqandfurious.fastqandfurious import entryfunc
>>> from fastqandfurious import fastqandfurious

I seem to get the same error with other versions of Python3.x, e.g.

>>> import sys
>>> print(sys.version)
3.6.8 (default, Oct 25 2019, 20:06:29) 
[GCC 4.2.1 Compatible Apple LLVM 11.0.0 (clang-1100.0.33.8)]
>>> from fastqandfurious import fastqandfurious, entryfunc
Traceback (most recent call last):
  File "<stdin>", line 1, in <module>
ImportError: cannot import name 'entryfunc'

Yes, this is a mistake in the README file. The demo/benchmark script is importing as you figured it out:

https://github.com/lgautier/fastq-and-furious/blob/master/src/demo/benchmark.py

Ah, this makes sense.

Ok, this issue is resolved. I appreciate the help! Feel free to close.

Addressing this in a PR here: #6