Problem sending an email in html with mime image
Hi everybody I have a question, here is my problem I want to send an
email with content in html with an image embed so I converted the
image binary in mime text and then I put the mime code inside the src
attribute of the html like this:
Then I send the email, here is my code:
from django.template.loader import render_to_string
from django.core.mail.message import EmailMultiAlternatives
contextcopy = {}
message = render_to_string('bulletin.html', contextcopy)
subject = "TEST"
msg = EmailMultiAlternatives(subject, message,
from_email,['[email protected]''])
msg.attach_alternative(message, "text/html")
msg.send()
The problem is that if I don't put the image mime code inside the src
the email is sent but when I put the code then the email is not send
and I don't get any error message.
Could somebody please, help me ???
Why the email is not send when I put the mime code of the image in the html ???
Regards,
Ariel
--
http://mail.python.org/mailman/listinfo/python-list
How to concatenate unicode strings ???
Hi everybody, how could I concatenate unicode strings ???
What I want to do is this:
unicode('this an example language ') + unicode('español')
but I get an:
Traceback (most recent call last):
File "", line 1, in
UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11:
ordinal not in range(128)
How could I concatenate unicode strings ???
Regards
Thanks in advance.
Ariel
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to concatenate unicode strings ???
And what about if after the string is concat I want it to pass is to the
command line to do anything else, for instance:
one_command = cadena.decode('utf-8') + cadena1.decode('utf-8')
commands.getoutput(one_comand)
But I receive this error:
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/commands.py", line 46, in getoutput
return getstatusoutput(cmd)[1]
File "/usr/lib/python2.6/commands.py", line 55, in getstatusoutput
pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in position
31: ordinal not in range(128)
How could I solve that ???
Regards
Ariel
On Tue, Apr 26, 2011 at 6:07 PM, Chris Rebert wrote:
> On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
> > Hi everybody, how could I concatenate unicode strings ???
> > What I want to do is this:
> >
> > unicode('this an example language ') + unicode('español')
> >
> > but I get an:
> > Traceback (most recent call last):
> > File "", line 1, in
> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11:
> > ordinal not in range(128)
> >
> > How could I concatenate unicode strings ???
>
> That error is from the 2nd call to unicode(), not from the
> concatenation itself. Use proper Unicode string literals:
>
> u'this an example language ' + u'español'
>
> You'll probably also need to add the appropriate source file encoding
> declaration; see http://www.python.org/dev/peps/pep-0263/
>
> Cheers,
> Chris
> --
> http://rebertia.com
>
--
http://mail.python.org/mailman/listinfo/python-list
Re: How to concatenate unicode strings ???
with commands.getoutput(one_comand.encode('utf-8')) it works !!!
On Tue, Apr 26, 2011 at 6:22 PM, Ariel wrote:
> And what about if after the string is concat I want it to pass is to the
> command line to do anything else, for instance:
> one_command = cadena.decode('utf-8') + cadena1.decode('utf-8')
> commands.getoutput(one_comand)
>
> But I receive this error:
>
> Traceback (most recent call last):
> File "", line 1, in
> File "/usr/lib/python2.6/commands.py", line 46, in getoutput
> return getstatusoutput(cmd)[1]
> File "/usr/lib/python2.6/commands.py", line 55, in getstatusoutput
> pipe = os.popen('{ ' + cmd + '; } 2>&1', 'r')
> UnicodeEncodeError: 'ascii' codec can't encode character u'\xf1' in
> position 31: ordinal not in range(128)
>
> How could I solve that ???
> Regards
> Ariel
>
>
> On Tue, Apr 26, 2011 at 6:07 PM, Chris Rebert wrote:
>
>> On Tue, Apr 26, 2011 at 8:58 AM, Ariel wrote:
>> > Hi everybody, how could I concatenate unicode strings ???
>> > What I want to do is this:
>> >
>> > unicode('this an example language ') + unicode('español')
>> >
>> > but I get an:
>> > Traceback (most recent call last):
>> > File "", line 1, in
>> > UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 11:
>> > ordinal not in range(128)
>> >
>> > How could I concatenate unicode strings ???
>>
>> That error is from the 2nd call to unicode(), not from the
>> concatenation itself. Use proper Unicode string literals:
>>
>> u'this an example language ' + u'español'
>>
>> You'll probably also need to add the appropriate source file encoding
>> declaration; see http://www.python.org/dev/peps/pep-0263/
>>
>> Cheers,
>> Chris
>> --
>> http://rebertia.com
>>
>
>
--
http://mail.python.org/mailman/listinfo/python-list
I get an error when I used urllib2.urlopen() to open a remote file in a ftp server
Hi everybody:
I get an error when I used urllib2.urlopen() to open a remote file in a ftp
server, My code is the following:
>>> file = 'ftp:/192.168.250.14:2180/RTVE/VIDEOS/Thisisit.wmv'
>>> mydata = urllib2.urlopen(file)
Traceback (most recent call last):
File "", line 1, in
File "/usr/lib/python2.6/urllib2.py", line 126, in urlopen
return _opener.open(url, data, timeout)
File "/usr/lib/python2.6/urllib2.py", line 391, in open
response = self._open(req, data)
File "/usr/lib/python2.6/urllib2.py", line 409, in _open
'_open', req)
File "/usr/lib/python2.6/urllib2.py", line 369, in _call_chain
result = func(*args)
File "/usr/lib/python2.6/urllib2.py", line 1316, in ftp_open
raise URLError('ftp error: no host given')
URLError:
But how you can see I get an error 'no host given'.
Any idea how to solve this ? Could you help me please ?
Regards
Ariel
--
http://mail.python.org/mailman/listinfo/python-list
Re: I get an error when I used urllib2.urlopen() to open a remote file in a ftp server
You are right, Thanks. On Thu, Jan 6, 2011 at 12:55 PM, Ian Kelly wrote: > On Thu, Jan 6, 2011 at 10:26 AM, Ariel wrote: > > Hi everybody: > > > > I get an error when I used urllib2.urlopen() to open a remote file in a > ftp > > server, My code is the following: > > > >>>> file = 'ftp:/192.168.250.14:2180/RTVE/VIDEOS/Thisisit.wmv' > > Looks to me like you're missing a slash separating the protocol from > the hostname. Try 'ftp://' instead of 'ftp:/'. > -- http://mail.python.org/mailman/listinfo/python-list
How to make a web services in python ???
Hi everybody, I need some help to find documentation about how to implements web services in python, could you help me please ??? Regards Thanks in advance Ariel -- http://mail.python.org/mailman/listinfo/python-list
Re: How to make a web services in python ???
Soap web services I think. On Fri, Sep 17, 2010 at 5:35 PM, Hidura wrote: > What kind of web-service you have in mind > > 2010/9/17, Ariel : > > Hi everybody, I need some help to find documentation about how to > implements > > web services in python, could you help me please ??? > > Regards > > Thanks in advance > > Ariel > > > > -- > Enviado desde mi dispositivo móvil > > Diego I. Hidalgo D. > -- http://mail.python.org/mailman/listinfo/python-list
Persist python objects without a relational DB
Hi, I would like to know which is the best framework to persist my python objects in disk. I heard about ZODB (http://www.zodb.org/en/latest/index.html) is this the best or there is another ? -- Ariel Argañaraz -- https://mail.python.org/mailman/listinfo/python-list
Problems with ZODB, I can not persist and object accessed from 2 threads
Hello, I am sorry I am stuck in this. And I need some help
I want to persist an Object with ZODB, the object can be accessed from 2
different threads. The ZODB manual says:
A multi-threaded program should open a separate Connection instance for
each thread. Different threads can then modify objects and commit their
modifications independently.
But there isn't an example of how to create a connection for each thread.
Can someone tell me how to connect to the same DB from 2 threads??
I attached an example of what I am trying to do.
And I get this error.
Traceback (most recent call last):
File "/usr/lib/python2.7/threading.py", line 810, in __bootstrap_inner
self.run()
File "/usr/lib/python2.7/threading.py", line 763, in run
self.__target(*self.__args, **self.__kwargs)
File "main.py", line 33, in thread_1
storage = FileStorage("/tmp/asdasd.fs")
File "/usr/lib/python2.7/site-packages/ZODB/FileStorage/FileStorage.py",
line 164, in *_init_*
self._lock_file = LockFile(file_name + '.lock')
File "/usr/lib/python2.7/site-packages/zc/lockfile/__init__.py", line 84,
in *_init_*
_lock_file(fp)
File "/usr/lib/python2.7/site-packages/zc/lockfile/__init__.py", line 59,
in _lock_file
raise LockError("Couldn't lock %r" % file.name)
LockError: Couldn't lock '/tmp/asdasd.fs.lock'
IF I don't connect in the "thread_1" class I can change things but
sometimes the changes from the main thread are not commited.
When I debug, I can see that when a change is made from the Second thread,
the "transaction_manager" creates a new Transaction here:
#manager.py
def get(self):
""" See ITransactionManager.
"""
if self._txn is None:
self._txn = Transaction(self._synchs, self)
return self._txn
When it happens that commit Seems to be executed succesfully but it doest
save the changes to the DB.
--
Ariel Argañaraz
main.py
Description: application/download
objects.py
Description: application/download
--
https://mail.python.org/mailman/listinfo/python-list
Create a .lua fle from Python
Hi,
This is my first post, I would like to know if a library that can help me
with this.
I want to parse a XML fle with Python and save the data into a Lua table
called for example "newTable", then I want to create a "table.lua" fle with
the "newTable" write on it.
for example:
the XML fle: cities.xml
BuenosAires
30
Seatle
25
And I want to create a cities_temp.lua file
cities_temps ={
["Buenos Aires"] = 30,
["Seatle"] = 25,
}
Is that posible to do with LUPA (https://pypi.python.org/pypi/lupa)?? In
the docs I read that you can create lua tables but I did not see if there
is a way to create a .lua file with that table.
I could do it with python writing to a file line per line but i want some
more elegant.
Can anyone give some help?
Thanks.
--
Ariel Argañaraz
--
https://mail.python.org/mailman/listinfo/python-list
Dictionary viewer and editor
http://mail.python.org/pipermail/python-list/2001-August/100288.html Did you ever finish writing this? -- <>0<>0<>0<>0<>0<>0<>0<>0<>0<>0 Ariel Balter Swain Hall West 025 Department of Physics Indiana University, Bloomington 737 E Third Street, 47404 [EMAIL PROTECTED] Office: (812) 855-2441 Home: (812) 332-2721 -- http://mail.python.org/mailman/listinfo/python-list
Which Python Wiki engine?
Kenneth, I thought this was a very interesting set of requests. Did you ever find a solution? Thanks, Ariel I'm looking for a Wiki engine to set up for my company, so that we can incrementally add user documentation for a fairly complex program, plus allow users to add their own comments for the benefit of others. I'd strongly prefer a Python-based Wiki, since that allows me the chance to add plugins with minimal effort (being a python enthusiast and programmer). However, I'd also like something that can provide a little more structure than MoinMoin seems able to provide (correct me if I'm wrong.) Though there would be cross-references amongst various sections, the idea is that the structure of the wiki would be very much that of an outline, with topics divided into sub topics and then into sub sub topics, etc. A person at our company would be the "editor"; responsible for setting up the original structure, putting in the documentation we currently have, and periodically editing contributions from users. Here are some of the features I'd greatly like to have that I haven't seen provided by the (relatively few) wiki engines I've looked at. Mind you, I don't claim to have looked at even these few exhaustively. (No time!) MoinMoin is the one I've looked at the most. 1) Automatically generated table of contents, based on the outline structure. This would be regenerated periodically (probably nightly) 2) Ability for users to add new subsections, but not to change that part of the document structure which has been locked by the editor. 3) Clear visual distinction between material added by the users, and material added or approved by the editor. 4) Legal-style numbering of sections, subsections, etc. 5) Ability to have single pages containing both locked text (which users cannot edit or delete) and unlocked text. Such a page would consist of one or more locked blocks of text, interspersed with comments put in by users. Users could put comments anywhere except side a locked text block. Ideally, this would also be something that doesn't depend on a backend database or other things besides the web server and python packages. This is not likely to be a wiki where huge amounts of interactivity must be supported; there will probably be a moderate amount of reading, and a small amount of writing. If you know of any Python wiki engines which can satisfy (even partially) this list, please let me know. I'd strongly prefer to have a Python engine. On the other hand, if you know of another type of wiki that matches well with these requirements, I won't complain if you mention it :-) Thanks, Ken McDonald -- <>0<>0<>0<>0<>0<>0<>0<>0<>0<>0 Ariel Balter, PhD Swain Hall West 025 Department of Physics & Biocomplexity Institute Indiana University, Bloomington 737 E Third Street, 47404 [EMAIL PROTECTED] Office: (812) 855-2441 Home: (812) 332-2721 http://www.physics.indiana.edu/~abalter -- http://mail.python.org/mailman/listinfo/python-list
negative numbers are not equal...
hello guys i just ran into this when comparing negative numbers, they start returning False from -6 down, but only when comparing with 'is' >>> m = -5 >>> a = -5 >>> m is a True >>> m = -6 >>> a = -6 >>> m is a False >>> m == a True i read that 'is' compares if they are really the same object, but i don't that's it because then why does -5 return True? of course i could only use == to compare, but still, what am i missing here? thanks in advance ariel -- http://mail.python.org/mailman/listinfo/python-list
Re: negative numbers are not equal...
Christian Heimes wrote: You are getting the result because Python optimized small integers. See http://svn.python.org/projects/python/trunk/Objects/intobject.c Integers between -5 and +256 are singletons as are some other objects like strings with one element or empty tuples. You must not rely on the optimization. i see now, so i guess that's also why id() returns the same address for them as well... i'll dive into the implementation file, it may be a bit out of my league but i'll see what i can gather, and hey, that's how it works, right? :-) thanks ariel -- http://mail.python.org/mailman/listinfo/python-list
Re: negative numbers are not equal...
well, i'm glad i stumbled upon this detail early on (i only had to fix about one page of code)... i'll just stick to 'is' when it concerns checking if it is the *same* object (memorywise) instead of an *equivalent* one... just before wrapping up, the special methods __eq__ and __ne__ are called upon == and !=, right? not for 'is', 'is not'... Steven D'Aprano wrote: Mathematicians often *define* equality as identity. That certainly makes sense when dealing with numbers -- what would it mean to say that there are (say) three different instances of the abstract integer 42, all equal yet not identical? I suggest that this simply doesn't make sense -- it is "not even wrong". Equality-as-identity may not hold in all areas of mathematics, but I think it is safe to say it holds for ideal (abstract) numbers, as opposed to implementations of numbers as bit patterns or objects in memory. http://en.wikipedia.org/wiki/Equality_(mathematics) but who knows? maybe abstract numbers -5 to 256 are optimized as well! :-) -- http://mail.python.org/mailman/listinfo/python-list
DUDA !!!!!!!!!!
Hola: Hoy en día me encuentro iniciandome dentro del python, en estos momentos quiero saber de que forma puedo eliminar un archivo de un compactado, ya sea zip, rar o cualquier otro. Estudie las librerías zipfile pero no tiene ninguna funcion que me permita hacerlo. Trabajo con python 2.5 salu2 Ariel This message was sent using IMP, the Internet Messaging Program. -- http://mail.python.org/mailman/listinfo/python-list
