Python3 exception in package VCFPy

47 Views Asked by At

I am trying to use the VCFPy package in Python3. Here are the first two lines of my program:

import vcfpy
reader = vcfpy.Reader("example_file.vcf")

and I get the error message:

File "/usr/local/lib/python3.10/dist-packages/vcfpy/parser.py", line 701, in init self._line = stream.readline() # trailing '\n' AttributeError: 'str' object has no attribute 'readline'

The program is running under Ubuntu 22.04.

1

There are 1 best solutions below

1
Rafael On

You might want to use vcfpy.Reader.from_path('example_file.vcf').

The Reader constructor accepts a stream, not a filename.