madison-ookla commented on a change in pull request #13371:
URL: https://github.com/apache/airflow/pull/13371#discussion_r550276117



##########
File path: airflow/upgrade/rules/airflow_macro_plugin_removed.py
##########
@@ -39,9 +39,16 @@ def _check_file(self, file_path):
         problems = []
         class_name_to_check = self.MACRO_PLUGIN_CLASS.split(".")[-1]
         with open(file_path, "r") as file_pointer:
-            for line_number, line in enumerate(file_pointer, 1):
-                if class_name_to_check in line:
-                    problems.append(self._change_info(file_path, line_number))
+            try:
+                for line_number, line in enumerate(file_pointer, 1):
+                    if class_name_to_check in line:
+                        problems.append(self._change_info(file_path, 
line_number))
+            except UnicodeDecodeError:
+                raise Exception(
+                    "Unable to read file {}, it may need to be added to the 
.airflowignore".format(

Review comment:
       I think this might run into the same [python 
2.7](https://docs.python.org/2/library/importlib.html) issue as the [other 
comment you 
made](https://github.com/apache/airflow/pull/13371/files#r550270606) 😮  I'm not 
opposed to changing this logic, if you have an alternate suggestion! I think 
the issue I was running into had to deal with the fact that the file was 
binary, not that it was in a different encoding (as I imagine `open` would 
handle other string encodings appropriately...but admittedly I know less about 
that side of things).




----------------------------------------------------------------
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.

For queries about this service, please contact Infrastructure at:
[email protected]


Reply via email to