apache / airflow

Apache Airflow - A platform to programmatically author, schedule, and monitor workflows
https://airflow.apache.org/
Apache License 2.0
36.38k stars 14.1k forks source link

apache-airflow-providers-samba module 'smbclient' has no attribute 'link' #30221

Closed Alexandrmrn closed 1 year ago

Alexandrmrn commented 1 year ago

Apache Airflow Provider(s)

samba

Versions of Apache Airflow Providers

apache-airflow 2.5.2 apache-airflow-providers-amazon 3.4.0 apache-airflow-providers-celery 2.1.4 apache-airflow-providers-cncf-kubernetes 4.0.2 apache-airflow-providers-common-sql 1.3.4 apache-airflow-providers-docker 2.7.0 apache-airflow-providers-elasticsearch 3.0.3 apache-airflow-providers-ftp 2.1.2 apache-airflow-providers-google 7.0.0 apache-airflow-providers-grpc 2.0.4 apache-airflow-providers-hashicorp 2.2.0 apache-airflow-providers-http 2.1.2 apache-airflow-providers-imap 2.2.3 apache-airflow-providers-microsoft-azure 3.9.0 apache-airflow-providers-microsoft-mssql 3.0.0 apache-airflow-providers-microsoft-winrm 3.0.0 apache-airflow-providers-mysql 2.2.3 apache-airflow-providers-odbc 2.0.4 apache-airflow-providers-postgres 4.1.0 apache-airflow-providers-redis 2.0.4 apache-airflow-providers-samba 4.1.0 apache-airflow-providers-sendgrid 2.0.4 apache-airflow-providers-sftp 2.6.0 apache-airflow-providers-slack 4.2.3 apache-airflow-providers-sqlite 2.1.3 apache-airflow-providers-ssh 2.4.4 apache-airflow-providers-telegram 3.0.0

Apache Airflow version

2.5.2

Operating System

linux suse

Deployment

Docker-Compose

Deployment details

just use docker-compose

What happened

Broken DAG: [/opt/airflow/dags/sambatest.py] Traceback (most recent call last): File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/samba/hooks/samba.py", line 30, in class SambaHook(BaseHook): File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/samba/hooks/samba.py", line 86, in SambaHook @wraps(smbclient.link) AttributeError: module 'smbclient' has no attribute 'link'

What you think should happen instead

perhaps issue like this https://stackoverflow.com/questions/72177073/attributeerror-module-mymodule-has-no-attribute-module1

for at first is seems should importing like instead of <import smbclient and use @wraps(smbclient.link)>

How to reproduce

Just create dag and import SambaHook

Anything else

No response

Are you willing to submit PR?

Code of Conduct

boring-cyborg[bot] commented 1 year ago

Thanks for opening your first issue here! Be sure to follow the issue template! If you are willing to raise PR to address this issue please do so, no need to wait for approval.

Alexandrmrn commented 1 year ago

I updated wheel file apache_airflow_providers_samba-4.1.0-py3-none-any set this code <...from smbclient import link @wraps(link) def link(self, src, dst, follow_symlinks=True): return link( ...> Then find this problem after installiing

File "/home/airflow/.local/lib/python3.7/site-packages/airflow/providers/samba/hooks/samba.py", line 26, in from smbclient import link ImportError: cannot import name 'link' from 'smbclient' (/home/airflow/.local/bin/smbclient.py)

samba.py checking wrong smbclient library: this path (/home/airflow/.local/bin/smbclient.py) really havent link attrubute but this path /home/airflow/.local/lib/python3.7/site-packages/smbclient/ init.py have it

potiuk commented 1 year ago

OK. Then it not an airlfow issue. You (or some of the packages you added) added smbclient.py to your ".local/bin" shadowing the smbclient package that gets installed . It does not seem to come from a package - becayse packages installing anything to "bin" folder wil not generally use .py extension. You must remove/rename the file.

Closing