Re: smtplib not working as expected

2014-12-26 Thread Vincent Vande Vyvre

Le 27/12/2014 03:52, Juan Christian a écrit :
On Fri Dec 26 2014 at 11:07:30 PM MRAB > wrote:

According to the docs, if you let the port parameter default to 0,
it'll use port 465.

I tested with my ISP.

Using port 465, it failed.

Using the default, it succeeded.

So, I changed the code how you said, but still not working.


Code:

import smtplib

fromaddr = 'mksfjnsfji4433j4...@bk.ru '
toaddrs = ['mksfjnsfji4433j4...@bk.ru ']

msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))

msg = msg + 'test'

server = smtplib.SMTP('smtp.mail.ru ')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()


Traceback:

send: 'ehlo [192.168.0.107]\r\n'
reply: b'250-smtp15.mail.ru \r\n'
reply: b'250-SIZE 73400320\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-AUTH PLAIN LOGIN XOAUTH2\r\n'
reply: b'250 STARTTLS\r\n'
reply: retcode (250); Msg: b'smtp15.mail.ru 
\nSIZE 73400320\n8BITMIME\nPIPELINING\nAUTH 
PLAIN LOGIN XOAUTH2\nSTARTTLS'
send: 'mail FROM:> size=70\r\n'

reply: b'250 2.0.0 OK\r\n'
reply: retcode (250); Msg: b'2.0.0 OK'
send: 'rcpt TO:>\r\n'
reply: b'550 SMTP is available only with SSL or TLS connection 
enabled.\r\n'
reply: retcode (550); Msg: b'SMTP is available only with SSL or TLS 
connection enabled.'

send: 'rset\r\n'
Traceback (most recent call last):
File ".\test.py", line 13, in 
server.sendmail(fromaddr, toaddrs, msg)
File "C:\Python34\lib\smtplib.py", line 793, in sendmail
raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'mksfjnsfji4433j4...@bk.ru 
': (550, b'SMTP is available only 
with SSL or TLS connection e

nabled.')}



Try with the TLS:


...
server.set_debuglevel(1)
server.ehlo()
server.starttls()
server.ehlo()
server.sendmail(
--
https://mail.python.org/mailman/listinfo/python-list


Re: smtplib not working as expected

2014-12-26 Thread Juan Christian
On Fri Dec 26 2014 at 11:07:30 PM MRAB  wrote:
According to the docs, if you let the port parameter default to 0,
it'll use port 465.

I tested with my ISP.

Using port 465, it failed.

Using the default, it succeeded.

So, I changed the code how you said, but still not working.


Code:

import smtplib

fromaddr = 'mksfjnsfji4433j4...@bk.ru'
toaddrs = ['mksfjnsfji4433j4...@bk.ru']

msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))

msg = msg + 'test'

server = smtplib.SMTP('smtp.mail.ru')
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()


Traceback:

send: 'ehlo [192.168.0.107]\r\n'
reply: b'250-smtp15.mail.ru\r\n'
reply: b'250-SIZE 73400320\r\n'
reply: b'250-8BITMIME\r\n'
reply: b'250-PIPELINING\r\n'
reply: b'250-AUTH PLAIN LOGIN XOAUTH2\r\n'
reply: b'250 STARTTLS\r\n'
reply: retcode (250); Msg: b'smtp15.mail.ru\nSIZE
73400320\n8BITMIME\nPIPELINING\nAUTH PLAIN LOGIN XOAUTH2\nSTARTTLS'
send: 'mail FROM: size=70\r\n'
reply: b'250 2.0.0 OK\r\n'
reply: retcode (250); Msg: b'2.0.0 OK'
send: 'rcpt TO:\r\n'
reply: b'550 SMTP is available only with SSL or TLS connection enabled.\r\n'
reply: retcode (550); Msg: b'SMTP is available only with SSL or TLS
connection enabled.'
send: 'rset\r\n'
Traceback (most recent call last):
File ".\test.py", line 13, in 
server.sendmail(fromaddr, toaddrs, msg)
File "C:\Python34\lib\smtplib.py", line 793, in sendmail
raise SMTPRecipientsRefused(senderrs)
smtplib.SMTPRecipientsRefused: {'mksfjnsfji4433j4...@bk.ru': (550, b'SMTP
is available only with SSL or TLS connection e
nabled.')}
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smtplib not working as expected

2014-12-26 Thread MRAB

On 2014-12-27 00:39, Juan Christian wrote:

I have the following test code:

import smtplib

fromaddr = 'mksfjnsfji4433j4...@bk.ru '
toaddrs  = ['mksfjnsfji4433j4...@bk.ru ']

msg = ("From: %s\r\nTo: %s\r\n\r\n"
% (fromaddr, ", ".join(toaddrs)))

msg = msg + 'test'

print("Message length is " + repr(len(msg)))

server = smtplib.SMTP('smtp.mail.ru ', 465)
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

And when I execute it, it keeps running forever and I don't get any
email. What's missing, what's wrong? The smtp server and port are
correct - https://help.mail.ru/enmail-help/mailer/popsmtp

I'm following this tutorial:https://docs.python.org/3/library/smtplib.html

Python 3.4.2


According to the docs, if you let the port parameter default to 0,
it'll use port 465.

I tested with my ISP.

Using port 465, it failed.

Using the default, it succeeded.

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


smtplib not working as expected

2014-12-26 Thread Juan Christian
I have the following test code:

import smtplib

fromaddr = 'mksfjnsfji4433j4...@bk.ru'
toaddrs  = ['mksfjnsfji4433j4...@bk.ru']

msg = ("From: %s\r\nTo: %s\r\n\r\n"
   % (fromaddr, ", ".join(toaddrs)))

msg = msg + 'test'

print("Message length is " + repr(len(msg)))

server = smtplib.SMTP('smtp.mail.ru', 465)
server.set_debuglevel(1)
server.sendmail(fromaddr, toaddrs, msg)
server.quit()

And when I execute it, it keeps running forever and I don't get any email.
What's missing, what's wrong? The smtp server and port are correct -
https://help.mail.ru/enmail-help/mailer/popsmtp

I'm following this tutorial:https://docs.python.org/3/library/smtplib.html

Python 3.4.2
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: learning to use iterators

2014-12-26 Thread Seb
Hi again,

Thanks for your input; I'm starting to use generators to some extent.

Say we have a series of numbers:

x = randn(100)

and values beyond some criteria should be considered as outliers, but
only where there's at most 3 (or some other integer) consecutive values
beyond the criteria.  The outliers should then be replaced with linearly
interpolated values using the non-outliers.

outs = abs(x) > 0.5 # identify candidate outliers
# where(outs) would tell the location of the outliers

Here we could use something like:

from itertools import groupby
for val, g in groupby(outs):
if outs:
len(list(g))# just getting sequence length here

to work with each outlier sequence, but then the indices in x are
forgotten.  They'd be needed to get the interpolates.  I feel there's
idioms that I should learn about to handle this situation more
effectively.

Cheers,

-- 
Seb

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


Re: suggestions for VIN parsing

2014-12-26 Thread Denis McMahon
On Thu, 25 Dec 2014 17:02:33 -0700, Vincent Davis wrote:

> I would like to parse the VIN, frame and engine numbers found on this
> page (below).

First of all you need to define the number of different patterns that are 
possible:

eg:

H + 3-5 digits -> twins Unit 350cc & 500cc '57 - '69

3 (or more?) digits + N -> twins Pre-Unit 500cc & 650cc '50
3-5 digits + NA -> twins Pre-Unit 500cc & 650cc '51 - '52
4-6 digits -> twins Pre-Unit 500cc & 650cc '52 - '60
D + 3-5 digits -> twins Pre-Unit 500cc & 650cc '60 - '62

DU + 3-5 digits -> twins Unit 650cc '63 - '69

etc etc etc

You need to define these closely enough so that there is no ambiguity 
between two different expressions.

Then you create regular expressions for each pattern, and test a given 
engine / frame number against each re in turn until you get a match.

You may then need to extract the digits and letters from the pattern to 
determine the actual month / year data. Here's an example algorithm:

if matches H + 3-5 digits:
get integer value of numeric part
if num >= 101 and num <= 760:
print "Unit 350cc & 500cc, 1957"
if num >= 761 and num <= 5484:
print "Unit 350cc & 500cc, 1958"
.
if matches DU + 3-5 digits:
get integer value of numeric part
if num >= 101 and num <= 5824:
print "Unit 650cc, 1963"
if num >= 5825 and num <= 13374:
print "Unit 650cc, 1964"

etc etc etc

Note, I think the 1981 model year ran KCA - DCA prefixes, not as shown on 
the website you quoted.

-- 
Denis McMahon, denismfmcma...@gmail.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Future of python on android

2014-12-26 Thread Fetchinson .
On 12/26/14, iMath  wrote:
> 在 2014年12月25日星期四UTC+8下午11时31分24秒,Fetchinson .写道:
>> Hi all,
>>
>> I was using sl4a for quite some time on android and it basically
>> worked very well although some features are missing. It looks like
>> sl4a is dead, although I could be wrong. Does anyone knowledgeable
>> have any further info on the future of sl4a? For instance it doesn't
>> work with android 5 and there doesn't seem to be any activity around
>> it for the past couple of years.
>>
>> If sl4a is out, what's the preferred way of running python on android?
>> Guido is still working at google, right? This makes me suspect that
>> python is ought to be part of the android ecosystem but can't find
>> anything else beyond sl4a.
>>
>> So what's the future proof way of writing/deploying/installing python
>> programs on android?
>>
>> Cheers,
>> Daniel
>>
>>
>> --
>> Psss, psss, put it down! - http://www.cafepress.com/putitdown
>
> According this post here,
> http://plashless.wordpress.com/2014/08/19/using-pyqtdeploy0-5-on-linux-to-cross-compile-a-pyqt-app-for-android/
>
> you can use PyQt5 for Android app development !

Nice, haven't heard about it, thanks for the pointer!

Daniel


> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Future of python on android

2014-12-26 Thread iMath
在 2014年12月25日星期四UTC+8下午11时31分24秒,Fetchinson .写道:
> Hi all,
> 
> I was using sl4a for quite some time on android and it basically
> worked very well although some features are missing. It looks like
> sl4a is dead, although I could be wrong. Does anyone knowledgeable
> have any further info on the future of sl4a? For instance it doesn't
> work with android 5 and there doesn't seem to be any activity around
> it for the past couple of years.
> 
> If sl4a is out, what's the preferred way of running python on android?
> Guido is still working at google, right? This makes me suspect that
> python is ought to be part of the android ecosystem but can't find
> anything else beyond sl4a.
> 
> So what's the future proof way of writing/deploying/installing python
> programs on android?
> 
> Cheers,
> Daniel
> 
> 
> -- 
> Psss, psss, put it down! - http://www.cafepress.com/putitdown

According this post here,
http://plashless.wordpress.com/2014/08/19/using-pyqtdeploy0-5-on-linux-to-cross-compile-a-pyqt-app-for-android/

you can use PyQt5 for Android app development !
-- 
https://mail.python.org/mailman/listinfo/python-list


ANN: PyQt v5.4 Released

2014-12-26 Thread Phil Thompson

PyQt5 v5.4 has been released and is available from
http://www.riverbankcomputing.com/software/pyqt/download5.

PyQt5 is a comprehensive set of bindings for v5 of Digia's Qt
cross-platform application framework.  It supports Python v3, v2.7 and
v2.6.

The highlights of this release include support for Qt v5.4 including the
new QtWebChannel and QtWebEngineWidgets modules.  The QtXml module has 
also

been restored.

PyQt5 supports cross-compiling to iOS and Android.

Windows installers are provided which contain everything needed for 
PyQt5
development (including Qt, Qt Designer, QScintilla, and MySQL, 
PostgreSQL,

SQLite and ODBC drivers) except Python itself.  Installers are provided
for the 32 and 64 bit versions of Python v3.4.

PyQt5 is implemented as a set of 33 extension modules including support
for:

- non-GUI infrastructure including event loops, threads, i18n, user and
  application settings, mapped files and shared memory

- GUI infrastructure including window system integration, event 
handling,

  2D graphics, basic imaging, fonts, OpenGL

- a comprehensive set of desktop widgets

- WebKit and Chromium based browsers

- WebSockets

- a client-side library for accessing Qt Cloud Services

- full integration with Quick2 and QML allowing new Quick items to be
  implemented in Python and created in QML

- event driven network programming

- multimedia including cameras, audio and radios

- Bluetooth

- global positioning using satellite, Wi-Fi or text file sources

- sensors including accelerometers, altimeters, compasses, gyroscopes,
  magnetometers, and light, pressure, proximity, rotation and 
temperature

  sensors

- serial ports

- SQL

- printing

- DBus

- XPath, XQuery, XSLT and XML Schema validation

- a help system for creating and viewing searchable documentation

- unit testing of GUI applications.
--
https://mail.python.org/mailman/listinfo/python-list


Re: Future of python on android

2014-12-26 Thread Chris Angelico
On Fri, Dec 26, 2014 at 8:42 PM, Fetchinson .  wrote:
> The best would of course be if the
> core developer team of python would bless an android distribution and
> keep it up to date just as with the linux/windows/macos python
> distribution. I don't know if that will happen though.

That would require someone to commit to maintaining it, and probably
donate a buildbot (at least, I don't think there are currently any
Android buildbots, though I may be wrong). If this is important enough
to you to put in some time and effort, talk to python-dev about what
it would take; it's entirely possible someone's already doing stuff
for it.

ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: OFF TOPIC Snow Crash [was Re: Hello World]

2014-12-26 Thread alister
On Fri, 26 Dec 2014 15:13:25 +1100, Steven D'Aprano wrote:

 
> Deep in the brain, well underneath the level of modern languages and
> consciousness, there is a deeper "machine language" of the brain. If you
> can write instructions in this machine language, you can control
> people's brains. Back in the distant past, the Sumerians learned how to
> do this via spoken language, but few people speak Sumerian any more,
> hence there are two versions of Snow Crash: one is a drug plus virus.
> The drug is to encourage people to inject themselves, which then allows
> the virus to get into their brain. The other is an animated bitmap,
> which contains "machine code" for the human brain, and is injected via
> the optic nerve (i.e. when a hacker sees it).

is this why web designers are now embeding QR codes in web pages?



-- 
Playing an unamplified electric guitar is like strumming on a picnic 
table.
-- Dave Barry, "The Snake"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Future of python on android

2014-12-26 Thread Fetchinson .
On 12/26/14, Steven D'Aprano  wrote:
> Fetchinson . wrote:
>
>> Guido is still working at google, right?
>
>
> No. Google is still using Python for lots of things, but Guido is now
> working for Dropbox.
>
> https://www.python.org/~guido/

Thanks, I missed the transition. The best would of course be if the
core developer team of python would bless an android distribution and
keep it up to date just as with the linux/windows/macos python
distribution. I don't know if that will happen though. It would make
sense because the number of android installations is growing rapidly.
By the way, is there a mobile strategy on the part of the core dev
team? Maybe not android, perhaps tizen is a better target but I'd say
it would make sense if some mobile platform would officially be
targeted.

Cheers,
Daniel



> --
> Steven
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Psss, psss, put it down! - http://www.cafepress.com/putitdown
-- 
https://mail.python.org/mailman/listinfo/python-list