Appending @Nikolaj's answer, please make sure that the path is a proper string
In my case, it was erroring out due to the comma because of incorrect commenting
file_name = 'dir/something.fits', # zshift = 1.738
hdus = fits.open(file_name)
Simply making it
file_name = 'dir/something.fits' # zshift = 1.738
hdus = fits.open(file_name)
solved the problem.