I've been working with GFS data in Python using pygrib, and have been able to download and process data stored in .grb and .grib2 file formats from the NCEP archive ftp site. When I switch over to try to open grib files from the real time analysis, however, I'm not able to. I've tried downloading manually and changing the ending of the file to .grib2 and .grb, but neither has worked. Here's the ftp site that I'm trying to access for reference: http://nomads.ncep.noaa.gov/pub/data/nccf/com/gfs/prod/gfs.2017061300/
Figured out my error: I was assuming that I needed to alter the filename endings / type in order to save as a genuine .grb or .grib2 file. The files are already in grib2 format despite the ending in .f000 so you should be able to leave them as that.
My other error was not double checking the exact filename and path when dealing with multiple grib files across the GFS datasets. Some have slight differences in the naming convention, and when loading on pygrib it will throw the same generic "import error" as if the file couldn't be read.