uranusjr commented on code in PR #24368:
URL: https://github.com/apache/airflow/pull/24368#discussion_r929526526


##########
airflow/operators/python.py:
##########
@@ -433,7 +433,8 @@ def execute_callable(self):
             if not isinstance(self.requirements, str):
                 requirements_file_contents = "\n".join(str(dependency) for 
dependency in self.requirements)
             else:
-                requirements_file_contents = self.requirements
+                with open(self.requirements, "r") as file:
+                    requirements_file_contents = "\n".join(file.readlines())

Review Comment:
   Perhaps we can do this:
   
   ```python
   if not isinstance(self.requirements, str):
       ...
   elif os.path.exists(self.requirements):
       with open(self.requirements, "r") as f:
           ...
   else:
       requirements_file_contents = self.requirements
   ```
   
   This helps keep compatibility to the “incorrect” use of providing one single 
requirement as the argument.



-- 
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.

To unsubscribe, e-mail: [email protected]

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

Reply via email to