diff --git a/rpg/core.py b/rpg/core.py
index 389bd436fe752b2188a6e626057d8ffec26db552..e670e4c62ac98db7f1ff601afefd7df9e719f318 100644
--- a/rpg/core.py
+++ b/rpg/core.py
@@ -227,7 +227,7 @@ def next_read(file, offset_start, offset_end):
 
     # Open the file, GZIP or not
     with (gzip.open(file, "rb") if magic == b"\x1f\x8b"
-          else open(file, "rb")) as in_file:
+          else open(str(file), "rb")) as in_file:
         first_line = in_file.readline().decode('utf-8')
         # FASTQ file
         if first_line.startswith("@"):