By using this site, you agree to our updated Privacy Policy and our Terms of Use. Manage your Cookies Settings.
434,726 Members | 2,465 Online
Bytes IT Community
+ Ask a Question
Need help? Post your question and get tips & solutions from a community of 434,726 IT Pros & Developers. It's quick & easy.

libgmail: attaching files

P: n/a
wal
How does one attach files to emails using libgmail? The following code
http://pramode.net/articles/lfy/fuse/4.txt
works fine when said files are simple text files, but it failes as soon as
the files are wild binary files, even attaching the source of an email in a
text file (.eml files) failes.
What am I missing here? Any hints?
The output I get when attemting to send binary files using the code above
is pasted below.

have fun,
wal

----------------------------------
Traceback (most recent call last):
File "C:\Documents and
Settings\lucp1735\Desktop\libgmail-0.1.5.1\knujon.py", line 24, in <module>
if ga.sendMessage(fs):
File "C:\Documents and
Settings\lucp1735\Desktop\libgmail-0.1.5.1\libgmail.py", line 582, in
sendMessage
msgStr = mimeMessage.as_string()
File "C:\program files\Python25\lib\email\message.py", line 131, in
as_string
g.flatten(self, unixfrom=unixfrom)
File "C:\program files\Python25\lib\email\generator.py", line 84, in
flatten
self._write(msg)
File "C:\program files\Python25\lib\email\generator.py", line 109, in
_write
self._dispatch(msg)
File "C:\program files\Python25\lib\email\generator.py", line 135, in
_dispatch
meth(msg)
File "C:\program files\Python25\lib\email\generator.py", line 201, in
_handle_multipart
g.flatten(part, unixfrom=False)
File "C:\program files\Python25\lib\email\generator.py", line 84, in
flatten
self._write(msg)
File "C:\program files\Python25\lib\email\generator.py", line 109, in
_write
self._dispatch(msg)
File "C:\program files\Python25\lib\email\generator.py", line 135, in
_dispatch
meth(msg)
File "C:\program files\Python25\lib\email\generator.py", line 266, in
_handle_message
g.flatten(msg.get_payload(0), unixfrom=False)
File "C:\program files\Python25\lib\email\message.py", line 185, in
get_payload
raise TypeError('Expected list, got %s' % type(self._payload))
TypeError: Expected list, got <type 'str'>
Oct 4 '06 #1
Share this question for a faster answer!
Share on Google+

This discussion thread is closed

Replies have been disabled for this discussion.