lmdu / pyfastx

a python package for fast random access to sequences from plain and gzipped FASTA/Q files
https://pyfastx.readthedocs.io
MIT License
262 stars 23 forks source link

Cannot read input file with Chinese text in filename #66

Closed meisproject closed 1 year ago

meisproject commented 1 year ago

Hi,

When I use pyfastx.Fasta to read a file with Chinese text in its path, it throw out a file exists error. And I'm sure the file exists.

My code is like this:

import os
import pyfastx

input_fasta = r'C:\Users\smei\Documents\新建文件夹\gene_cds_hg38.fa'
if os.path.exists(input_fasta):
    print(f"{input_fasta} exists.")
else:
    print(f"{input_fasta} not exists.")
all_seq = pyfastx.Fasta(input_fasta)

And the following is the output and trackback: C:\Users\smei\Documents\新建文件夹\gene_cds_hg38.fa exists. Traceback (most recent call last): File "C:\Users\smei\Downloads\test.py", line 9, in all_seq = pyfastx.Fasta(input_fasta) FileExistsError: the input fasta file C:\Users\smei\Documents\新建文件夹\gene_cds_hg38.fa does not exists

Thanks!

lmdu commented 1 year ago

Thank you for reporting this issue. I will fixed it in next version.

lmdu commented 1 year ago

Added support for chinese in version 2.0.0.