Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeError: 'UUID' object has no attribute 'rfind'` #56

Closed
j10sanders opened this issue Nov 2, 2016 · 3 comments
Closed

AttributeError: 'UUID' object has no attribute 'rfind'` #56

j10sanders opened this issue Nov 2, 2016 · 3 comments

Comments

@j10sanders
Copy link

Hello!

I'm getting this error when I try to send an email with yagmail. At this point, I have my password in the code, since I am just testing it out. Here is what my code looks like, followed by the error message:

yag = yagmail.SMTP('<MYEMAILREDACTED>', '<MYPWREDACTED>') contents = ['This is the body, and here is your pwreset key:', key, 'Did that work?'] yag.send('<EMAILREDACTED>', 'TEST', contents)

error below:

Traceback (most recent call last): File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1836, in __call__ return self.wsgi_app(environ, start_response) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1820, in wsgi_app response = self.make_response(self.handle_exception(e)) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1403, in handle_exception reraise(exc_type, exc_value, tb) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1817, in wsgi_app response = self.full_dispatch_request() File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1477, in full_dispatch_request rv = self.handle_user_exception(e) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1381, in handle_user_exception reraise(exc_type, exc_value, tb) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/_compat.py", line 33, in reraise raise value File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1475, in full_dispatch_request rv = self.dispatch_request() File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/flask/app.py", line 1461, in dispatch_request return self.view_functions[rule.endpoint](**req.view_args) File "/home/ubuntu/workspace/crossword/crossword/views.py", line 405, in pwresetrq_post yag.send('<REDACTED>', 'TEST', contents) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/yagmail/yagmail.py", line 98, in send msg = self._prepare_message(addresses, subject, contents, attachments, headers) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/yagmail/yagmail.py", line 217, in _prepare_message has_included_images, content_objects = self._prepare_contents(contents) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/yagmail/yagmail.py", line 276, in _prepare_contents content_object = self._get_mime_object(content) File "/home/ubuntu/workspace/crossword/env/lib/python3.4/site-packages/yagmail/yagmail.py", line 343, in _get_mime_object content_name = os.path.basename(content_string) File "/usr/lib/python3.4/posixpath.py", line 139, in basename i = p.rfind(sep) + 1 AttributeError: 'UUID' object has no attribute 'rfind'

Can you help me figure out what I need to fix this? Thanks!

@j10sanders
Copy link
Author

Appears it is the key that I am trying to send, which was made with uuid.uuid4()

I should probably just close this issue, but do you know why I'm not able to attach this variable, that I have the line before in my code?

@j10sanders
Copy link
Author

had to cast it to a string :) closing the issue

@kootenpv
Copy link
Owner

kootenpv commented Nov 2, 2016

Glad you resolved it!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants