#๐ Does anyone know how to fix this error?
47 messages ยท Page 1 of 1 (latest)
@odd slate
Remember to:
- Ask your Python question, not if you can ask or if there's an expert who can help.
- Show a code sample as text (rather than a screenshot) and the error message, if you've got one.
- Explain what you expect to happen and what actually happens.
:warning: Do not pip install anything that isn't related to your question, especially if asked to over DMs.
!pastebin the error message if its too long @odd slate
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\email\generator.py", line 115, in flatten
self._write(msg)
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\email\generator.py", line 180, in _write
self._dispatch(msg)
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\email\generator.py", line 217, in _dispatch
meth(msg)
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\email\generator.py", line 275, in _handle_multipart
g.flatten(part, unixfrom=False, linesep=self._NL)
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\email\generator.py", line 106, in flatten
old_msg_policy = msg.policy
^^^^^^^^^^
AttributeError: 'str' object has no attribute 'policy'
SMTPObject.sendmail(strFromEmail, strEmail, RootEmailMsg.as_string())
RootEmailMsg.as_string() is causing it.
If your code is too long to fit in a codeblock in Discord, you can paste your code here:
https://paste.pythondiscord.com/
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
Tried that - that causes a different error
what error?
If I could figure out how to put my code in here I would.
Use the pastebin
So what do I do with that?
After pasting your code, save it by clicking the Paste! button in the bottom left, or by pressing CTRL + S. After doing that, you will be navigated to the new paste's page. Copy the URL and post it here so others can see it.
I hate it when programmers try to do fancy stuff and end up making a damn nuisance of themselves.
Ctrl S from where for god's sake?
If you just hit CTRL + S on that page, the page URL will change to something else
Copy that URL and paste it here
Mine looks like this: https://paste.pythondiscord.com/NRDQ
better
Why can't you just paste a small amount of code in the post rather than go through that rigmaroll!
Except none of these lines do anything to the error message here โ๏ธ
You can paste "small amount of code" in the post. As long as its below 2000 characters
And make sure to use the Discord code format for better readability
It wouldn't let me do it.
RootEmailMsg.as_string() That causes the error
So what am I doing wrong with setting up RootEmailMsg in that code?
What happens if you take away .as_string()?
Get a different error
Can I see it?
Yeah I tried copying the code from this pastebin directly to Discord, its over 2000 characters.
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\smtplib.py", line 177, in quote_periods
return re.sub(br'(?m)^.', b'..', bindata)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\gregaryb\AppData\Local\Programs\Python\Python312\Lib\re_init.py", line 186, in sub
return _compile(pattern, flags).sub(repl, string, count)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
TypeError: expected string or bytes-like object, got 'MIMEMultipart'
https://paste.pythondiscord.com/5SQQ
That is the entire code if it is any help.
No idea sorry
This help channel has been closed and it's no longer possible to send messages here. If your question wasn't answered, feel free to create a new post in #1035199133436354600. To maximize your chances of getting a response, check out this guide on asking good questions.