Use source loader explicitly
The call to spec_from_file_location
seems to fail for scripts without the .py
extension (see !1145 (merged)). This change uses SourceFileLoader
explicitly as a Python script seems to be expected here. I also added an error check for the case where the creation of the module spec fails for some reason.