Re: Thread termination

2006-10-13 Thread Aidan Steele
G'day,As far as my understanding pertains, the thread dies
shortly after the function returns (ends). You can call "return"
anywhere within the function and kill the thread in the middle of its
execution.On 13 Oct 2006 02:38:28 -0700, Teja <[EMAIL PROTECTED]> wrote:
Hi all,Does any one know how to terminate or kill a thread that is startedwith "start_new_thread()" in the middle of its execution?Any pointers?Thanks in advanceTeja.--
http://mail.python.org/mailman/listinfo/python-list
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: enable pop3 for gmail from python

2006-12-11 Thread Aidan Steele

He wants to automate the process of enabling POP access to Gmail, not access
his Inbox via POP (which he can already do). That much said, a quick looksee
at the Google site shows no mention of an automated method of doing this.
That is not to say it is impossible, but it may be infeasible to do as one
would have to write login code et al just to be authorised to do it - using
one of the more advanced HTTP libraries, most likely.

Sorry I couldn't solve the problem directly, but maybe my clarification will
help someone who can. ;-)

On 12/12/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote:


At Sunday 10/12/2006 08:36, radu voicilas wrote:

>Hi!I am making a script to connect to my gmail box and grep new
>mails.I want to know if i can enable pop from python if it is not
>enabled from gmail?I have been searching the python list but i
>haven't found an answer to thisonly ways of connecting to the
>server wich i already know.
>Thank you very much!

Have you read http://gmail.google.com/support/bin/answer.py?answer=10350 ?
Using poplib you can connect to the gmail pop3 server - what's your
problem?


--
Gabriel Genellina
Softlab SRL

__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar


--
http://mail.python.org/mailman/listinfo/python-list


-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Tarfile .bz2

2006-12-11 Thread Aidan Steele

As far as I know, tar.gz and tar.bz2 files work in exactly the same way, but
use different algorithms. That is to say, all the files are 'tarballed'
together, then the resulting very long string is run through the gz bz2
algorithm and out pops the compressed file. (These compression algorithms
work on arbitrary strings, not files per se.)

Why are you trying to losslessly compress JPG and PNG files? Chances are you
won't be able to compress them any more, but if you're trying to free space,
take a looksy at "pngcrush". You'll find it on Google - I don't want to put
any hyperlinks in this email lest it is marked as spam.

Hope I've helped,
Aidan.

On 11 Dec 2006 17:32:58 -0800, Jordan <[EMAIL PROTECTED]> wrote:


So that would explain why a tar.bz2 archive can't be appended to
wouldn't it...  And also explain why winrar was so slow to open it (not
something I mentioned before, but definitely noticed).  I had wondered
what it was that made bz2 so much better at compression than zip and
rar.  Not really on topic anymore but what's the method for tar.gz? And
even more off the topic, does anyone know a good lossless compression
method for images (mainly .jpg and .png)?

Cheers,
Jordan


Wolfgang Draxinger wrote:
> Jordan wrote:
>
> > When using python to create a tar.bz2 archive, and then using
> > winrar to open the archive, it can't tell what the compressed
> > size of each
> > individual file in the archive is.  Is this an issue with
> > winrar or is there something that needs to be set when making
> > the archive that isn't there by default.
>
> When compressing a tar archive all files in the archive are
> compressed as a whole, i.e. you can only specify a compression
> ration for the whole archive and not just for a single file.
>
> Technically a tar.bz2 is actually a aggregation of multiple files
> into a single tar file, which is then compressed.
>
> This is different to e.g. PKZip in which each file is compressed
> individually and the compressed files are then merged into an
> archive.
>
> The first method has better compression ratio, since redundancies
> among files are compressed, too, whereas the latter is better if
> you need random access to the individual files.
>
> Wolfgang Draxinger
> --
> E-Mail address works, Jabber: [EMAIL PROTECTED], ICQ: 134682867

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Password, trust and user notification

2006-12-11 Thread Aidan Steele

Hi,

As you said yourself -- it's all about trust. If this person knows nothing
of programming, then (s)he is obviously at the mercy of the programmers,
which is why we have warranties in commerical software, reputuations to
uphold in the open source arena and malware elsewhere. ;-) Sure, there will
always be people that will abuse your trust and we should all do whatever we
can to avoid such people, but realistically the only people writing
open-source software of any notability will usually be fairly trustworthy
people, even if only out of necessity as their reputation is on the line.

Failing that, there's no reason one could not pay an independent third-party
code auditor to inspect the code. Such auditors will usually guarantee the
safety of products they've investigated, but this comes at a cost. Hope this
helps.

On 11 Dec 2006 20:16:31 -0800, placid <[EMAIL PROTECTED]> wrote:


Hi all,

I was going to write this script for a friend that notifies him via
logging onto his Gmail account and sending him an email to his work
email about some events occurring in the execution of the script.
If you enter your password into a script as input how can someone trust
the programmer that he will not send a email to himself containing his
password? Assuming this person does not know anything about programming
and this person knows nothing about programming ethics.

This is coming from the fact that i need to notify the user in someway
that does not require her to constantly watch the execution of the
script, for example when a user signs in to Windows Live Messenger pop
up.


Cheers


1. http://libgmail.sourceforge.net/  This is the library i use to
access a Gmail account via Python

--
http://mail.python.org/mailman/listinfo/python-list

-- 
http://mail.python.org/mailman/listinfo/python-list

Re: speed of python vs matlab.

2006-12-13 Thread Aidan Steele

On 13 Dec 2006 16:07:20 -0800, Chao <[EMAIL PROTECTED]> wrote:


I've been trying to develop some numerical codes with python, however
got disappointed.

A very simple test,

a = 1.0

for i in range(1000):
 for j in range(1000):
   a = a+1

unfortunately, it took 4.5 seconds to finish(my machines is fine. P4
3.0G, 1G RAM, it varies according to machine configuration, but should
be in the same level)

for matlab, the same operation took 0.1 seconds,

I use numpy & scipy, they solve the problem most of the times, but
there are cases you can't avoid loops by vectors. I appreciate the
elegancy of python so much, but I guess I have to gave it up in these
numerical codes.(image processing algorithms),  for application
dev/scripting, it's still my first choice.

A good news is that the same code takes ruby 9.8 seconds.

--
http://mail.python.org/mailman/listinfo/python-list



Have you considered looking into Psyco? (http://psyco.sourceforge.net/) For
all the numeric operations that image processing algorithms entail, such a
tool will probably make a tremendous difference in terms of speed of
execution for you. Do yourself a favour and check it out.

Hope this helps,
Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Password, trust and user notification

2006-12-13 Thread Aidan Steele

On 13 Dec 2006 15:45:09 -0800, placid <[EMAIL PROTECTED]> wrote:



Gabriel Genellina wrote:


> You DON'T need the password for the receiving account just to send him
> an email!
> And you don't even need that special Gmail library, smtplib should be
> fine.

Yes you dont need a password to receive email, but to access Gmail and
send an email you do. Yes you do need the Gmail library to access Gmail
because the script will run on a computer that doesnt have a smtp
server.

Is there other way's of notifying the user?


Cheers

--
http://mail.python.org/mailman/listinfo/python-list




What Gabriel said was correct.  You can use smtplib to connect to Gmail's
SMTP server as the library supports SSL/TLS required by Gmail (see here:
http://mail.google.com/support/bin/answer.py?answer=13287&topic=1556)

You do not need a local SMTP server to use smtplib, just use the values
found in that provided URL. Hope this helps,

Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Password, trust and user notification

2006-12-13 Thread Aidan Steele

On 12/14/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote:


At Wednesday 13/12/2006 20:45, placid wrote:

> > You DON'T need the password for the receiving account just to send him
> > an email!
> > And you don't even need that special Gmail library, smtplib should be
> > fine.
>
>Yes you dont need a password to receive email, but to access Gmail and
>send an email you do. Yes you do need the Gmail library to access Gmail
>because the script will run on a computer that doesnt have a smtp
>server.
>
>Is there other way's of notifying the user?

Use the standard SMTP class to connect to the destination SMTP server.
To determine the right server, issue a DNS request for MX records on
the destination domain. (You may have to search for any suitable DNS
module since none is available in the standard Python distribution).

If you are really too lazy and you *know* the destination will
*always* be a gmail account and you don't bother if things go wrong
tomorrow, these are some current MX records for gmail.com:



While what you said is technically correct, I think you misread their
original question. They want to send email *from* the Gmail account *to* the
work account. I suggested that he use Gmail's SMTP server to send the email.

Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Password, trust and user notification

2006-12-13 Thread Aidan Steele

On 12/14/06, Gabriel Genellina <[EMAIL PROTECTED]> wrote:


At Wednesday 13/12/2006 21:44, Aidan Steele wrote:

>While what you said is technically correct, I think you misread
>their original question. They want to send email *from* the Gmail
>account *to* the work account. I suggested that he use Gmail's SMTP
>server to send the email.

They were concerned about putting sensitive information (password)
inside the script, in order to connect to Gmail to send the mail
notifications.
I say that there is no need to use Gmail smtp services: to send mail
*to* [EMAIL PROTECTED], you only have to connect to the right SMTP
server for anywhere.com. The *from* email address is irrelevant and
can even be faked.
Of course a spam filter could block such mails, but you have to test it.


--
Gabriel Genellina
Softlab SRL

__
Correo Yahoo!
Espacio para todos tus mensajes, antivirus y antispam ¡gratis!
¡Abrí tu cuenta ya! - http://correo.yahoo.com.ar



Rather than "could block such mails" [sic], I'm fairly certain any
respectable server would drop the mail. The prevalence of SPF and other
assorted tools combat this, when used for malicious purposes. Sure, it's
worth trying, but I doubt it will work. Good luck to them. ;-)

Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list

Re: Password, trust and user notification

2006-12-14 Thread Aidan Steele

On 14 Dec 2006 15:22:35 -0800, placid <[EMAIL PROTECTED]> wrote:



Dennis Lee Bieber wrote:
> On Thu, 14 Dec 2006 11:44:14 +1100, "Aidan Steele" <[EMAIL PROTECTED]>
> declaimed the following in gmane.comp.python.general:
>
> > While what you said is technically correct, I think you misread their
> > original question. They want to send email *from* the Gmail account
*to* the
> > work account. I suggested that he use Gmail's SMTP server to send the
email.
> >
>   The most confusing thing is that is sounds very much like they
want
> to use the /recipient's/ Gmail account to send email to the
> /recipient's/ work email account -- rather than connecting directly to
> the recipient's work account mail server. (Of course, it may be that
> their own ISP blocks pass-through SMTP -- that's a different matter) --


Ok, everyone now forget that i even asked about connecting to Gmail and
sending an email back to the work email, for some reason you guys are
not answering my question.

Is there any other way (other than email's !) to notify a user of
events within a script?

Thanks for all the help.
Cheers

--
http://mail.python.org/mailman/listinfo/python-list



Perhaps by using instant messaging, eg: Jabber? (http://
jabberpy.sourceforge.net/)

You could create an account for the daemon/script and have it send messages
to the client throughout the script's execution. Fewer security concerns in
that setup!

Aidan Steele.
-- 
http://mail.python.org/mailman/listinfo/python-list