@@ -449,21 +449,23 @@ def import_generic(filename, readerlist, fmthint=None, bank=None,
449449 elif flag :
450450 primaryReaders .append (reader )
451451 if not secondaryReaders and not primaryReaders :
452- print ('Available importers:' )
453- for reader in readerlist :
454- print (f'\t { reader .longFormatName } ' )
455452 # common reason for read error -- package needed?
456453 l = []
457454 for i in Readers ['importErrpkgs' ]:
458455 for j in G2fil .condaRequestList [i ]:
459456 if j not in l : l .append (j )
460- if Readers ['importErrpkgs' ]:
457+ print (f'\n Reading of file { filename !r} failed.' )
458+ if fmthint is not None and hintcount == 0 :
459+ print (f'\n No readers matched hint { fmthint !r} \n ' )
460+ if Readers ['importErrpkgs' ]:
461+ print ('Not all importers are available due to uninstalled Python packages.' )
461462 print ('The following importer(s) are not available:\n ' +
462463 f'\t { ", " .join (Readers ["importErrpkgs" ])} ' )
463464 print ('because the following optional Python package(s) are not installed:\n ' +
464465 f'\t { ", " .join (l )} \n ' )
465- if fmthint is not None and hintcount == 0 :
466- print (f'No readers matched hint { fmthint !r} \n ' )
466+ print ('Available importers:' )
467+ for reader in readerlist :
468+ print (f'\t { reader .longFormatName } ' )
467469 raise G2ImportException (f"Could not read file: { filename } " )
468470
469471 with open (filename , 'r' ):
0 commit comments