kootenpv / yagmail

Send email in Python conveniently for gmail using yagmail
MIT License
2.64k stars 263 forks source link

Attribute error when importing yagmail #233

Closed TechWiz-3 closed 2 years ago

TechWiz-3 commented 2 years ago

I'm using Python 3.9.0 on MacOS Mojave 10.14.6 I installed yagmail using pip install yagmail[all] I'm having an error when attempting to import yagmail

>>> import yagmail
Exception ignored in: <function Client.__del__ at 0x108843790>
Traceback (most recent call last):
  File "/Users/Peregrine/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 1139, in __del__
    self.close()
  File "/Users/Peregrine/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 1111, in close
    self._transport.close()
AttributeError: 'Client' object has no attribute '_transport'

Any help would be much appreciated

TechWiz-3 commented 2 years ago

I tested yagmail on a Ubuntu VM and didn't have any errors, is the error something to do with my OS version?

kootenpv commented 2 years ago

it mentions loading httpx - this should not be loaded in yagmail, maybe that's related

possibly the name of your script

TechWiz-3 commented 2 years ago

My script actually doesn't have a name, I'm using the python prompt thingy in the terminal.

TechWiz-3 commented 2 years ago

Not sure how the error could show up if yagmail doesn't use httpx tho 😅

kootenpv commented 2 years ago

could you maybe create a new folder without any files in there and then start python and try again?

kootenpv commented 2 years ago

also maybe try to reinstall without [all]

TechWiz-3 commented 2 years ago

Alright I've done both

pip uninstall yagmail[all]
pip install yagmail
mkdir empty
cd empty
python3
>>> import yagmail

And received the same error

Exception ignored in: <function Client.__del__ at 0x10b79c790>
Traceback (most recent call last):
  File "/Users/Peregrine/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 1139, in __del__
    self.close()
  File "/Users/Peregrine/Library/Python/3.9/lib/python/site-packages/httpx/_client.py", line 1111, in close
    self._transport.close()
AttributeError: 'Client' object has no attribute '_transport'

I searched the AttributeError: 'Client' object has no attribute '_transport' error up, seems like others have had it before when using httpx in their code

kootenpv commented 2 years ago

thx for trying... it seems so weird

maybe try uninstall and installing httpx again?

TechWiz-3 commented 2 years ago

Thanks a lot, updating httpx worked, now i can import yagmail without any errors :)