External ISO keyboards treated as ANSI since MacBook Pro upgraded to macOS Sierra 10.12 Since I upgraded my MacBook Pro to macOS Sierra, two keys seems to have been switched around in the keyboard when I use my external keyboard. 

I use the Spanish ISO layout, and the "º" and "&lt;" keys have been swapped. The laptop's keyboard works fine. I have not fiddled with the keyboard configuration, other than changing to my regional layout and swapping modifier keys (it's a windows keyboard).

It worked flawlessly1 before the upgrade. I know very little of how to troubleshoot macOS, what should I do?

1 I just remembered that, no, it wasn't all that flawless; from time to time the keyboard would stop responding, and I'd have to unplug and plug again. Don't think it's related, but...

PD: It happens with all external Keyboards. Tried with a few. All of them where ISO, and it seems the problem is in macOS treating my ISO keyboards as ANSI; the laptop's internal keyboard is ISO though, and has no issue. I've done a clean install of Sierra, and it's still wrong.
I had the same problem with my keyboard and a German layout. Although I had "German" set up as "System Preferences/Keyboard/Input Source" most of my keys had the wrong mapping. E.g. the key right to the Left Shift Key on my keyboard is "&lt;>" instead it was mapped to "^°".

The problem was that my keyboard was setup as an ANSI-type of keyboard (used in the US). Instead it should have been set up as a ISO-type (used in most european countries).

There are several possible solutions to this mapping problem as described by Tom Gewecke on his Blog.


  The fix for this is to run the Keyboard Setup Assistant again. Sometimes there is a button for "Change Keyboard Type" visible in "System Preferences/Keyboard".
  
  If not, you can try trashing the file
  /Library/Preferences/com.apple.keyboardtype.plist
  and restarting your machine.
  
  Another possibility may be to open Terminal and type:
  sudo open /System/Library/CoreServices/KeyboardSetupAssistant.app/Contents/MacOS/KeyboardSetupAssistant


When the Keyboard Setup Assistant appears again after reboot be sure to choose the right type of keyboard - ISO.

If none of that helps follow the above link to Toms post with further options.