On 12 Okt., 17:09, Jean-Paul Calderone <[EMAIL PROTECTED]> wrote:
> If you get an incorrect padding error, try appending a "=" and decoding
> again. If you get the error again, try appending one more "=". If it
> still doesn't work, then you might be out of luck.
This seems to work in some cases
Hello everybody,
I am using a python script to extract images from email messages. This
works fine for some messages, but not all attached images can be
decoded. I use the following code to decode the image and save it to a
database:
try:
imagedec = base64.b64decode(imageenc)
imagehash = md5.
On 12 Sep., 16:39, Istvan Albert <[EMAIL PROTECTED]> wrote:
> This line reads an entire message into memory as a string. Is it
> possible that you have a huge email in there (hundreds of MB) with
> some attachment encoded as text?
No, the largest single message with the mbox is about 100KB large.
On 12 Sep., 12:20, David <[EMAIL PROTECTED]> wrote:
> It may be that Python's garbage collection isn't keeping up with your app.
>
> You could try periodically forcing it to run. eg:
>
> import gc
> gc.collect()
I tried this, but the problem is not solved. When invoking the garbage
collection afte
Hello everybody,
I have to convert a huge mbox file (~1.5G) to MySQL.
I tried with the following simple code:
for m in mailbox.mbox(fileName):
msg = m.as_string(True)
hash = md5.new(msg).hexdigest()
try:
dbcurs.execute("""INSERT INTO archive (hash, msg) VALUES (%s,
%s)""", (hash, ms
Neil Cerutti schrieb:
> In other words, the fourth argument to sub is count, not a set of
> re flags.
I knew it had to be something very stupid.
Thanks a lot.
--
http://mail.python.org/mailman/listinfo/python-list
Hello everybody,
I wanted to use re.sub to strip all HTML tags out of a given string. I
learned that there are better ways to do this without the re module,
but I would like to know why my code is not working. I use the
following:
def stripHtml(source):
source = re.sub("[\n\r\f]", " ", source)
Hello,
I try to write a python application with wx that shows images from a
MySQL database. I use the following code to connect and get data when
some event was triggered:
dbconn = MySQLdb.connect(host="localhost", user="...", passwd="...",
db="images")
dbcurs = dbconn.cursor()
dbcurs.execute("""
Hello everybody,
I try to use an external OCR tool to convert some binary image data to
text. The image is in one variable, the text should be converted to
another. I use the following code:
(si, so, se) = os.popen3('ocrad')
si.write(frame)
si.close()
messagetext += so.read()
This code l
Hello,
I want to use the re module to split a data stream that consists of
several blocks of data. I use the following code:
iter = re.finditer('^(HEADER\n.*)+$', data)
The data variable contains binary data that has the word HEADER in it
in some places and binary data after this word till the n
Just got the solution...
After sending the image data with "si.write(image)", I have to close
the pipe to tell the program to convert the image with "si.close()".
Now everything works fine.
Christoph
--
http://mail.python.org/mailman/listinfo/python-list
Hello everybody,
I need to get the different frames from a GIF image in my python
script and want to use the giftopnm program from netpbm to get the
frames and directly convert them to pnm files. I tried to use the
following code:
for image in images:
if (image[0:3] == 'GIF'):
(si, so,
12 matches
Mail list logo