Email.mime.text import error

653 views
Skip to first unread message

forgaibdi

unread,
Dec 2, 2009, 1:53:48 PM12/2/09
to PyInstaller
I am using a program that sends emails. While I am runing it under the
extension .py it works fine when I turn it into an .exe using the
trunk version it gives me this error when i run the .exe :

Traceback (most recent call last):
File "<string>", line 2, in <module>
File "mail\build\pyi.win32\mail\outPYZ1.pyz/email", line 79, in
__getattr__
File "C:\windowz\newproject\trunk\iu.py", line 458, in importHook
raise ImportError, "No module named %s" % fqname
ImportError: No module named email.mime.text

What can I do to solve this?

Laurent

unread,
Dec 16, 2009, 3:13:03 AM12/16/09
to PyInstaller
Can't help a lot but two ideas:
If you use pickle module, and email.mime.text is a pickle d strucutre,
then pyinstaller have no way to know that it needed to import
email.mime.text
so be sure to add "import email.mime.text" at te top of your script,
so pyinstaller will add it to the dependacy.
(I had this sort of issue with pickle...)

If not a pickle issue, try anyway the import email.mime.text on top of
your script, just in case.

joao abrantes

unread,
Dec 16, 2009, 5:30:45 AM12/16/09
to pyins...@googlegroups.com
i use the following imports on my code:
import smtplib
from email.MIMEText import MIMEText

--

You received this message because you are subscribed to the Google Groups "PyInstaller" group.
To post to this group, send email to pyins...@googlegroups.com.
To unsubscribe from this group, send email to pyinstaller...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/pyinstaller?hl=en.



Laurent Dufrechou

unread,
Dec 16, 2009, 5:42:16 AM12/16/09
to pyins...@googlegroups.com

Add :

import email.mime.text # patch to make pyinstaller force import missing library

 

Pynstaller will add this dependancy in the .exe.

It will remove the error you see.

 

Perhaps, there is something that wan be done inside pyinstaller code (like an hook) but never tried J

 

De : pyins...@googlegroups.com [mailto:pyins...@googlegroups.com] De la part de joao abrantes
Envoyé : mercredi 1
6 décembre 2009 11:31
À : pyins...@googlegroups.com
Objet : Re: [PyInstaller] Re: Email.mime.text import error

Reply all
Reply to author
Forward
0 new messages