marclamberti opened a new issue, #48665:
URL: https://github.com/apache/airflow/issues/48665
### Apache Airflow version
3.0.0
### If "Other Airflow 2 version" selected, which one?
_No response_
### What happened?
Hey there,
I think we have an issue with .map(). When I try to loop over the
_MapedResult object, I'm getting a NoneType object error, whereas the exact
same code in AF2.0 works and prints the file.
### What you think should happen instead?
Each file should be printed out on the standard output like in AF 2.0
### How to reproduce
```python
def filter_file_extension(file: str) -> str:
if file.rsplit('.', 1)[1] == 'zip':
return None
return file
@dag
def my_dag():
@task
def return_files() -> list[str]:
return ["a.txt", "b.zip", "c.txt"]
@task
def print_filtered_files(files: list[str]) -> None:
for file in files:
print(file) # <---- 'NoneType' object has not attribute 'rsplit' , in
AF2.0 that prints the file correctly
filtered_files = return_files().map(filter_file_extension)
print_filtered_files(filtered_files)
```
### Operating System
Mac
### Versions of Apache Airflow Providers
_No response_
### Deployment
Docker-Compose
### Deployment details
_No response_
### Anything else?
_No response_
### Are you willing to submit PR?
- [ ] Yes I am willing to submit a PR!
### Code of Conduct
- [x] I agree to follow this project's [Code of
Conduct](https://github.com/apache/airflow/blob/main/CODE_OF_CONDUCT.md)
--
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]