Enable unicode

2014-01-28 Thread Igor Korot
Hi, ALL,
In here: http://stackoverflow.com/questions/21397035/set-utf8-on-mysql,
I got a suggestion to enable "use_unicode".
Problem is I'm developing on Windows and it's not that I can recompile
my python.
I'm using Python2.7 on Windows XP.

Any pointer on how do I enable "use_unicode"?

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


Re: Enable unicode

2014-01-28 Thread Chris Angelico
On Tue, Jan 28, 2014 at 7:26 PM, Igor Korot  wrote:
> Hi, ALL,
> In here: http://stackoverflow.com/questions/21397035/set-utf8-on-mysql,
> I got a suggestion to enable "use_unicode".
> Problem is I'm developing on Windows and it's not that I can recompile
> my python.
> I'm using Python2.7 on Windows XP.
>
> Any pointer on how do I enable "use_unicode"?

Before you go any further: MySQL has a broken interpretation of "utf8"
that allows only a subset of the full Unicode range. Instead, use
"utf8mb4", which is what the rest of the world calls UTF-8. As far as
I know, you can just switch in utf8mb4 everywhere that you're
currently using utf8 and it'll work.

According to [1] the use_unicode flag is a keyword parameter to
connect(). As much as possible, I'd recommend using those parameters
rather than explicitly executing SQL statements to reconfigure the
connection - it's clearer, and the local client might want to
reconfigure itself in response to the change too.

Be aware that MySQL has a number of issues with Unicode and sorting
(or at least, it did the last time I checked, which was a while ago
now), not to mention other problems with its default MyISAM format.
You may want to consider PostgreSQL instead.

ChrisA

[1] http://mysql-python.sourceforge.net/MySQLdb.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Mark Lawrence

On 28/01/2014 07:19, wxjmfa...@gmail.com wrote:

Different, but a little bit related. The work
which is done actually on the possibility (not
implemented but alreay realized) to colorize (style")
the different graphemes of a glyph is very interesting.

Python with its absurd Flexible String Representation
just become a no go for the kind of task.

(Should not be too complicate to understand.)

jmf



This guy has surely exceeded his "three strikes and you're out" limit? 
Please, please somebody do something about it, he's driving me insane 
with this continuous drivel.  No thread appears to be safe from him 
jumping in with this nonsense.


--
My fellow Pythonistas, ask not what our language can do for you, ask 
what you can do for our language.


Mark Lawrence

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


Re: Enable unicode

2014-01-28 Thread Chris Angelico
On Tue, Jan 28, 2014 at 7:56 PM, Igor Korot  wrote:
> Hi, Chris,

Hi! I'm hoping it was oversight that led to this email coming to me
personally instead of to the list, and hoping that you won't mind me
responding on-list.

> On Tue, Jan 28, 2014 at 12:35 AM, Chris Angelico  wrote:
>> On Tue, Jan 28, 2014 at 7:26 PM, Igor Korot  wrote:
>>> Hi, ALL,
>>> In here: http://stackoverflow.com/questions/21397035/set-utf8-on-mysql,
>>> I got a suggestion to enable "use_unicode".
>>> Problem is I'm developing on Windows and it's not that I can recompile
>>> my python.
>>> I'm using Python2.7 on Windows XP.
>>>
>>> Any pointer on how do I enable "use_unicode"?
>>
>> Before you go any further: MySQL has a broken interpretation of "utf8"
>> that allows only a subset of the full Unicode range. Instead, use
>> "utf8mb4", which is what the rest of the world calls UTF-8. As far as
>> I know, you can just switch in utf8mb4 everywhere that you're
>> currently using utf8 and it'll work.
>
> So instead of using 'utf8' just use 'utf8mb4'?

Yes, that's right. Unless utf8mb4 isn't supported, in which case try
utf8 and see if you can use the full range (something might be
translating it for you, which would probably be a good thing).

>> According to [1] the use_unicode flag is a keyword parameter to
>> connect(). As much as possible, I'd recommend using those parameters
>> rather than explicitly executing SQL statements to reconfigure the
>> connection - it's clearer, and the local client might want to
>> reconfigure itself in response to the change too.
>
> Is it supported on all versions of MySQLDB?

No idea! I don't use MySQLDB, so just give it a shot and see if it works.

>> Be aware that MySQL has a number of issues with Unicode and sorting
>> (or at least, it did the last time I checked, which was a while ago
>> now), not to mention other problems with its default MyISAM format.
>> You may want to consider PostgreSQL instead.
>
> I'm not using MyISAM, only InnoDB. ;-)

That's good, but it doesn't cover everything. You may find that
non-ASCII strings get mis-sorted.

I strongly prefer PostgreSQL for anything where I actually care about
the data I'm storing. And yes, that's everything that I store. So I
don't use MySQL anywhere any more :)

> So, how do I properly write the connection lines?

I've no idea - I don't actually use MySQLDB, I just looked at the docs
:) But try adding use_unicode=True to your connect() call.

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


Re: Enable unicode

2014-01-28 Thread Igor Korot
Hi, Chris,

On Tue, Jan 28, 2014 at 1:00 AM, Chris Angelico  wrote:
> On Tue, Jan 28, 2014 at 7:56 PM, Igor Korot  wrote:
>> Hi, Chris,
>
> Hi! I'm hoping it was oversight that led to this email coming to me
> personally instead of to the list, and hoping that you won't mind me
> responding on-list.

Sorry about that.
I keep forgetting that gmail web mail is stupid and does not use the
list address on "Reply".
Does not happen to other list, only this one.

>
>> On Tue, Jan 28, 2014 at 12:35 AM, Chris Angelico  wrote:
>>> On Tue, Jan 28, 2014 at 7:26 PM, Igor Korot  wrote:
 Hi, ALL,
 In here: http://stackoverflow.com/questions/21397035/set-utf8-on-mysql,
 I got a suggestion to enable "use_unicode".
 Problem is I'm developing on Windows and it's not that I can recompile
 my python.
 I'm using Python2.7 on Windows XP.

 Any pointer on how do I enable "use_unicode"?
>>>
>>> Before you go any further: MySQL has a broken interpretation of "utf8"
>>> that allows only a subset of the full Unicode range. Instead, use
>>> "utf8mb4", which is what the rest of the world calls UTF-8. As far as
>>> I know, you can just switch in utf8mb4 everywhere that you're
>>> currently using utf8 and it'll work.
>>
>> So instead of using 'utf8' just use 'utf8mb4'?
>
> Yes, that's right. Unless utf8mb4 isn't supported, in which case try
> utf8 and see if you can use the full range (something might be
> translating it for you, which would probably be a good thing).

So you mean just try it in the python  console and see if it works?

>
>>> According to [1] the use_unicode flag is a keyword parameter to
>>> connect(). As much as possible, I'd recommend using those parameters
>>> rather than explicitly executing SQL statements to reconfigure the
>>> connection - it's clearer, and the local client might want to
>>> reconfigure itself in response to the change too.
>>
>> Is it supported on all versions of MySQLDB?
>
> No idea! I don't use MySQLDB, so just give it a shot and see if it works.

Problem is it might work on my machine, but the person I'm working
with/for might have earlier version of the driver.
That's actually why I asked on SO - is it supported on all versions of MySQLDB.

>
>>> Be aware that MySQL has a number of issues with Unicode and sorting
>>> (or at least, it did the last time I checked, which was a while ago
>>> now), not to mention other problems with its default MyISAM format.
>>> You may want to consider PostgreSQL instead.
>>
>> I'm not using MyISAM, only InnoDB. ;-)
>
> That's good, but it doesn't cover everything. You may find that
> non-ASCII strings get mis-sorted.
>
> I strongly prefer PostgreSQL for anything where I actually care about
> the data I'm storing. And yes, that's everything that I store. So I
> don't use MySQL anywhere any more :)

Hehe.
Originally the software was written for SQLite.
Then mySQL support was added and now the new script should be made
based on the existing one and this new script will be used in a web
based app - Django + jQuery/jQWidgets.
The person is not a developer, rather have a management background so
he is going with the market trend, which is currently mySQL for web
app. ;-)
I'd very much prefer to use SQLite as the data we use are text of the
different length which is more suitable for SQLite. But

>
>> So, how do I properly write the connection lines?
>
> I've no idea - I don't actually use MySQLDB, I just looked at the docs
> :) But try adding use_unicode=True to your connect() call.

OK, will do, thx.

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


Re: Enable unicode

2014-01-28 Thread Chris Angelico
On Tue, Jan 28, 2014 at 8:20 PM, Igor Korot  wrote:
>>> So instead of using 'utf8' just use 'utf8mb4'?
>>
>> Yes, that's right. Unless utf8mb4 isn't supported, in which case try
>> utf8 and see if you can use the full range (something might be
>> translating it for you, which would probably be a good thing).
>
> So you mean just try it in the python  console and see if it works?

Yep. Play around with four categories of character: ASCII, Latin-1,
Basic Multilingual Plane, and Supplementary Multilingual Plane. They
correspond to codepoints <128, <256, <65536, and <1114112.

>>> Is it supported on all versions of MySQLDB?
>>
>> No idea! I don't use MySQLDB, so just give it a shot and see if it works.
>
> Problem is it might work on my machine, but the person I'm working
> with/for might have earlier version of the driver.
> That's actually why I asked on SO - is it supported on all versions of 
> MySQLDB.

Try it on yours, try it on theirs; or dig through the docs to see when
it was added. Hard to say without knowing exactly what version your
client is using.

>> I strongly prefer PostgreSQL for anything where I actually care about
>> the data I'm storing. And yes, that's everything that I store. So I
>> don't use MySQL anywhere any more :)
>
> Hehe.
> Originally the software was written for SQLite.
> Then mySQL support was added and now the new script should be made
> based on the existing one and this new script will be used in a web
> based app - Django + jQuery/jQWidgets.
> The person is not a developer, rather have a management background so
> he is going with the market trend, which is currently mySQL for web
> app. ;-)
> I'd very much prefer to use SQLite as the data we use are text of the
> different length which is more suitable for SQLite. But

Market trend is deceptive AND meaningless. Yes, there's a general
notion that low-grade web servers will give you Apache, MySQL, and
PHP, while not offering anything else; but that's like saying that a
dirt-cheap car comes with a radio and no CD player, ergo you should be
listening to the radio even in a car that has (or could have) a CD
player. The reason cheap web hosts offer MySQL is because lots of
people ask for it, and the reason people ask for it is because lots of
hosts offer it. There's no other reason. If you're the expert and he's
of management background, then it's your job to sell the technically
superior option despite his initial gut feeling... be an advocate, not
an automaton. :) And hopefully he'll respect your skills enough to
listen to your advice.

I don't have much experience with SQLite, but I would suspect that
"text of different lengths" should be able to be handled equally
cleanly by any database engine - at least the major ones. You may want
to look into whether you use VARCHAR, TEXT, or some other data type,
but it should work just fine.

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


Coordinates TK and Turtle

2014-01-28 Thread duxbuz
Hello

I have some weird results when I run my code which is meant to display a canvas 
and a turtle and some text with the turtles coordinates.

Basically the turtle coordinates do not seem to correspond with the TK 
create_text coordinates.


t1.goto(100,100)

canvas_id = cv1.create_text(t1.xcor(), t1.ycor(), 
font=("Purisa",12),anchor="nw")

cv1.insert(canvas_id, 0, t1.pos())

I end up with this output:
http://i1025.photobucket.com/albums/y319/duxbuz/coord-issues_zps1fca6d2b.jpg

Could anyone help please?

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


ANN: EmPy 3.3.2 released (Python 3.x compatibility)

2014-01-28 Thread Erik Max Francis

Summary

A powerful and robust templating system for Python.


Overview

EmPy is a system for embedding Python expressions and statements
in template text; it takes an EmPy source file, processes it, and
produces output.  This is accomplished via expansions, which are
special signals to the EmPy system and are set off by a special
prefix (by default the at sign, '@').  EmPy can expand arbitrary
Python expressions and statements in this way, as well as a
variety of special forms.  Textual data not explicitly delimited
in this way is sent unaffected to the output, allowing Python to
be used in effect as a markup language.  Also supported are
callbacks via hooks, recording and playback via diversions, and
dynamic, chainable filters.  The system is highly configurable via
command line options and embedded commands.

Expressions are embedded in text with the '@(...)' notation;
variations include conditional expressions with '@(...?...!...)'
and the ability to handle thrown exceptions with '@(...$...)'.  As
a shortcut, simple variables and expressions can be abbreviated as
'@variable', '@object.attribute', '@function(arguments)',
'@sequence' [index], and combinations.  Full-fledged statements
are embedded with '@{...}'.  Control flow in terms of conditional
or repeated expansion is available with '@[...]'.  A '@' followed
by a whitespace character (including a newline) expands to
nothing, allowing string concatenations and line continuations.
Comments are indicated with '@#' and consume the rest of the line,
up to and including the trailing newline.  '@%' indicate
"significators," which are special forms of variable assignment
intended to specify per-file identification information in a
format which is easy to parse externally.  Context name and line
number changes can be done with '@?' and '@!' respectively.
'@<...>' markups are customizeable by the user and can be used for
any desired purpose.  Escape sequences analogous to those in C can
be specified with '@\...', and finally a '@@' sequence expands to
a single literal at sign.


Getting the software

The current version of empy is 3.3.2.

The latest version of the software is available in a tarball here:
http://www.alcyone.com/software/empy/empy-latest.tar.gz.

The official URL for this Web site is
http://www.alcyone.com/software/empy/.


Requirements

EmPy should work with any version of Python from 2.4 onward,
including 3.x.


License

This code is released under the LGPL.



Release history [since 3.3]

- 3.3.2; 2014 Jan 24.  Additional fix for source compatibility
  between 2.x and 3.0.

- 3.3.1; 2014 Jan 22.  Source compatibility for 2.x and 3.0;
  1.x and Jython compatibility dropped.


--
Erik Max Francis && m...@alcyone.com && http://www.alcyone.com/max/
 San Jose, CA, USA && 37 18 N 121 57 W && AIM/Y!M/Jabber erikmaxfrancis
  Sitting in the den and / Looking at the phone as if it owed / Owed me
   a favor -- Blu Cantrell
--
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Steven D'Aprano
On Mon, 27 Jan 2014 23:19:03 -0800, wxjmfauth wrote:

> Different, but a little bit related. The work which is done actually on
> the possibility (not implemented but alreay realized) to colorize
> (style") the different graphemes of a glyph is very interesting.
> 
> Python with its absurd Flexible String Representation just become a no
> go for the kind of task.
> 
> (Should not be too complicate to understand.)

No, not complicated at all. 

Water is wet, therefore the FSR is rubbish.

Athens is the capital of Greece, therefor the FSR is rubbish.

1+1 = 2, therefore the FSR is rubbish.

The South American Potoo is a member of the Nyctibiidae family, therefore 
the FSR is rubbish.

We get the point, thank you.


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


uninstalling python27 killed vim (actual issue was more complicated and involves Mercurial)

2014-01-28 Thread Peter
I'm posting this information to help others who are transitioning from 
Python 2.x to Python 3.x and are using Vim and Mercurial on Windows.


BACKGROUND

Old workstation configuration: 32-bit Windows XP/SP3, Python 2.7.6 and 
3.3.3, Mercurial 2.8.2, PATH contained Python before Mercurial, dual 
boot with Slackware 14.0


New workstation configuration: 64-bit Windows 7/SP1, 64-bit Python 
3.3.3, 64-bit Mercurial 2.8.2, PATH contained Python before Mercurial, 
dual boot with Slackware64 14.1


Early last year, I ported dozens of Python 2.7 tools that I wrote to 
automate various development tasks to Python 3 (via 2to3 script and 
testing).  After the ports were completed, I had my colleagues replace 
their Python2 installations with Python3.  We quickly uncovered/fixed a 
few issues (mostly related to Unicode) that I missed in my initial 
testing.  We've been happily running the Python3 versions for months 
now, but I've been reluctant to remove Python27 from my old (soon to be 
retired) workstation.


PROBLEM

Yesterday, I finally decided to say goodbye to Python27 on Windows and 
uninstalled it from my old workstation.  A little while later, I noticed 
that vim no longer worked.  Gvim.exe silently failed and vim.exe failed 
with the following error:


ImportError: No module named site

After reading the relevant vim documentation 
(http://vimdoc.sourceforge.net/htmldoc/if_pyth.html#python-dynamic) and 
doing a few Google searches, I decided to run vim under windbg to see 
what was actually going on.  Windbg showed that vim loaded the 
python27.dll from my Mercurial installation just before exiting.  A 
quick look inside Mercurial's library.zip file showed that the site.py 
module was not included.  OK, so now things were starting to make sense.


WORKAROUND

I took Mercurial out of the PATH, which returned vim to working order. 
I then wrote the following two line hg.bat script and copied it to a 
directory include in the PATH:


@echo off
"C:\Program Files\Mercurial\hg.exe" %*

With this workaround, both vim and hg appear to be once again working on 
the old workstation.


64-BIT WINDOWS

As the vim for Windows package I installed is a 32-bit application, I 
didn't have this issue on 64-bit Windows using 64-bit Mercurial. 
However, I believe the same issue would occur if 32-bit Mercurial is 
used on 64-bit Windows.


Hopefully this information is useful to other Python, Vim, and Mercurial 
users.


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


Wikipedia XML Dump

2014-01-28 Thread kevingloveruk
Hi

I have downloaded and unzipped the xml dump of Wikipedia (40+GB). I want to use 
Python and the SAX module (running under Windows 7) to carry out off-line 
phrase-searches of Wikipedia and to return a count of the number of hits for 
each search. Typical phrase-searches might be "of the dog" and "dog's".

I have some limited prior programming experience (from many years ago) and I am 
currently learning Python from a course of YouTube tutorials. Before I get much 
further, I wanted to ask:

Is what I am trying to do actually feasible?

Are there any example programs or code snippets that would help me?

Any advice or guidance would be gratefully received.

Best regards,
Kevin Glover
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Coordinates TK and Turtle

2014-01-28 Thread Peter Otten
dux...@gmail.com wrote:

> Hello
> 
> I have some weird results when I run my code which is meant to display a
> canvas and a turtle and some text with the turtles coordinates.
> 
> Basically the turtle coordinates do not seem to correspond with the TK
> create_text coordinates.
> 
> 
> t1.goto(100,100)
> 
> canvas_id = cv1.create_text(t1.xcor(), t1.ycor(),
> font=("Purisa",12),anchor="nw")
> 
> cv1.insert(canvas_id, 0, t1.pos())
> 
> I end up with this output:
> http://i1025.photobucket.com/albums/y319/duxbuz/coord-
issues_zps1fca6d2b.jpg
> 
> Could anyone help please?

The image you provide suggests (x, y) --> (x, -y), but a quick look into the 
source reveals that it is a little more complex:

>>> print inspect.getsource(turtle._Screen._write)
def _write(self, pos, txt, align, font, pencolor):
"""Write txt at pos in canvas with specified font
and color.
Return text item and x-coord of right bottom corner
of text's bounding box."""
x, y = pos
x = x * self.xscale
y = y * self.yscale
anchor = {"left":"sw", "center":"s", "right":"se" }
item = self.cv.create_text(x-1, -y, text = txt, anchor = 
anchor[align],
fill = pencolor, font = font)
x0, y0, x1, y1 = self.cv.bbox(item)
self.cv.update()
return item, x1-1

Rather than repeating the above calculation in your own code I suggest that 
you use turtle.write()

>>> import turtle
>>> turtle = turtle.getturtle()
>>> turtle.goto(100, 100)
>>> turtle.write("Hello, world!")


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


MailingLogger 3.8.0 Released!

2014-01-28 Thread Chris Withers

I'm pleased to announce a new release of Mailinglogger.

Mailinglogger provides two handlers for the standard python
logging framework that enable log entries to be emailed either as the
entries are logged or as a summary at the end of the running process.

The handlers have the following features:

- customisable and dynamic subject lines for emails sent

- emails sent with a configurable headers for easy filtering

- flood protection to ensure the number of emails sent is not excessive

- support for SMTP servers that require authentication

- fully documented and tested

This release adds flood limiting to the SummarisingLogger, ensuring that 
emails it sends aren't bigger than MTAs are prepared to handle.


Full docs can be found here:

http://packages.python.org/mailinglogger/

For more information, please see:
http://www.simplistix.co.uk/software/python/mailinglogger
or
http://pypi.python.org/pypi/mailinglogger

cheers,

Chris

--
Simplistix - Content Management, Zope & Python Consulting
   - http://www.simplistix.co.uk



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


Re: Enable unicode

2014-01-28 Thread Ben Finney
Igor Korot  writes:

> On Tue, Jan 28, 2014 at 1:00 AM, Chris Angelico  wrote:
> > Hi! I'm hoping it was oversight that led to this email coming to me
> > personally instead of to the list, and hoping that you won't mind me
> > responding on-list.
>
> Sorry about that.
> I keep forgetting that gmail web mail is stupid and does not use the
> list address on "Reply".

The “reply” command is for replying only to the article author So that
is working correctly.

> Does not happen to other list, only this one.

Many mailing lists are misconfigured, breaking the “reply” command so it
doesn't do what it's meant to (and you lose the facility to reply only
to the author of the message).

Instead, for replying to a list, you need the “reply to list” command
http://david.woodhou.se/reply-to-list.html>. Sadly, it appears
GMail does not have this command; you may want to use a better mail
client which implements this feature.

-- 
 \ “I must say that I find television very educational. The minute |
  `\   somebody turns it on, I go to the library and read a book.” |
_o__)—Groucho Marx |
Ben Finney

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


Re: Enable unicode

2014-01-28 Thread Rustom Mody
On Tuesday, January 28, 2014 2:50:20 PM UTC+5:30, Igor Korot wrote:
> Hi, Chris,

> On Tue, Jan 28, 2014 at 1:00 AM, Chris Angelico  wrote:
> > On Tue, Jan 28, 2014 at 7:56 PM, Igor Korot  wrote:
> >> Hi, Chris,
> > Hi! I'm hoping it was oversight that led to this email coming to me
> > personally instead of to the list, and hoping that you won't mind me
> > responding on-list.

> Sorry about that.
> I keep forgetting that gmail web mail is stupid and does not use the
> list address on "Reply".
> Does not happen to other list, only this one.

In gmail: Gear-icon -> Settings -> Default-reply behavior select all
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: uninstalling python27 killed vim (actual issue was more complicated and involves Mercurial)

2014-01-28 Thread Steven D'Aprano
On Tue, 28 Jan 2014 06:13:06 -0500, Peter wrote:

> I'm posting this information to help others who are transitioning from
> Python 2.x to Python 3.x and are using Vim and Mercurial on Windows.
[...]

Thank you Peter for posting your experiences here! We need more of these 
sorts of informational posts.

Regards,


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


Re: Enable unicode

2014-01-28 Thread Chris Angelico
On Wed, Jan 29, 2014 at 3:06 AM, Rustom Mody  wrote:
>> Sorry about that.
>> I keep forgetting that gmail web mail is stupid and does not use the
>> list address on "Reply".
>> Does not happen to other list, only this one.
>
> In gmail: Gear-icon -> Settings -> Default-reply behavior select all

That's an imperfect solution, but it's the one I use. You then have to
remember to delete the individual sender's address, or that person
will get a duplicate copy.

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


ANN: eGenix pyOpenSSL Distribution 0.13.3.1.0.1.6

2014-01-28 Thread eGenix Team: M.-A. Lemburg

ANNOUNCING

   eGenix.com pyOpenSSL Distribution

 Version 0.13.3.1.0.1.6


 An easy-to-install and easy-to-use distribution
 of the pyOpenSSL Python interface for OpenSSL -
available for Windows, Mac OS X and Unix platforms


This announcement is also available on our web-site for online reading:
http://www.egenix.com/company/news/eGenix-pyOpenSSL-Distribution-0.13.3.1.0.1.6.html


INTRODUCTION

The eGenix.com pyOpenSSL Distribution includes everything you need to
get started with SSL in Python.

It comes with an easy-to-use installer that includes the most recent
OpenSSL library versions in pre-compiled form, making your application
independent of OS provided OpenSSL libraries:

http://www.egenix.com/products/python/pyOpenSSL/

pyOpenSSL is an open-source Python add-on that allows writing SSL/TLS-
aware network applications as well as certificate management tools:

https://launchpad.net/pyopenssl/

OpenSSL is an open-source implementation of the SSL/TLS protocol:

http://www.openssl.org/


NEWS

This new release of the eGenix.com pyOpenSSL Distribution updates the
included pyOpenSSL and OpenSSL versions:

New in the eGenix pyOpenSSL Distribution


 * Updated pyOpenSSL to the upstream trunk revision 171 (pyOpenSSL
   version 0.13.1+).

 * Added work-around for compiling pyOpenSSL trunk revision 171 on
   Windows with OpenSSL 1.0.0 and later.

 * Included support for TLS 1.1 and 1.2 in pyOpenSSL (rev 171). Please
   see the TLS support section in the documentation for details.

   http://www.egenix.com/products/python/pyOpenSSL/doc/#TLS_support

 * Added SSL.OP_NO_COMPRESSION and SSL.OP_SINGLE_ECDH_USE context
   options to be able to address the CRIME attack and allow for more
   secure elliptic curve Diffie-Hellman key exchange setups.

 * Added HTML Sphinx documentation from the pyOpenSSL trunk version to
   the package. An online version is available from our website:

   http://www.egenix.com/products/python/pyOpenSSL/doc/pyopenssl.html

 * Updated the included CA bundles to the latest Mozilla 2014-01-28
   version.

 * Included ca-bundle*.crt files now have the same modification date
   as the Mozilla certdata.txt file from which they were generated.

 * Restored compatibility of the ca_bundle module with Python 2.4.

 * Enhanced the included https_client.py example to show case OpenSSL
   best practices:

   - server name parsing (RFC 2818 support will follow in one of the
 next releases)

   - SNI (support for TLS extension to support multiple SSL sites on a
 single host)

   - setup secure default SSL options

   - setup secure default SSL cipher suite

   - use TLS 1.0 - 1.2 only

   - disable SSL compression negotiation (prevent CRIME attack)

New in OpenSSL
--

 * Updated included OpenSSL libraries from OpenSSL 1.0.1e to
   1.0.1f. See http://www.openssl.org/news/news.html and
   http://www.openssl.org/news/vulnerabilities.html for a complete
   list of changes, most important:

   - CVE-2013-4353: A carefully crafted invalid TLS handshake could
 crash OpenSSL with a NULL pointer exception. A malicious server
 could use this flaw to crash a connecting client.

   - CVE-2013-6450: A flaw in DTLS handling can cause an application
 using OpenSSL and DTLS to crash.

   - CVE-2013-6449: A flaw in OpenSSL can cause an application using
 OpenSSL to crash when using TLS version 1.2.

As always, we provide binaries that include both pyOpenSSL and the
necessary OpenSSL libraries for all supported platforms:
Windows x86 and x64, Linux x86 and x64, Mac OS X PPC, x86 and x64.

We've also added egg-file distribution versions of our eGenix.com
pyOpenSSL Distribution for Windows, Linux and Mac OS X to the
available download options. These make setups using e.g. zc.buildout
and other egg-file based installers a lot easier.


DOWNLOADS

The download archives and instructions for installing the package can
be found at:

http://www.egenix.com/products/python/pyOpenSSL/


UPGRADING

Before installing this version of pyOpenSSL, please make sure that
you uninstall any previously installed pyOpenSSL version. Otherwise,
you could end up not using the included OpenSSL libs.

___
SUPPORT

Commercial support for these packages is available from eGenix.com.
Please see

http://www.egenix.com/services/support/

for details about our support offerings.


MORE INFORM

Re: Wikipedia XML Dump

2014-01-28 Thread Rustom Mody
On Tuesday, January 28, 2014 5:15:32 PM UTC+5:30, Kevin Glover wrote:
> Hi

> I have downloaded and unzipped the xml dump of Wikipedia (40+GB). I want to 
> use Python and the SAX module (running under Windows 7) to carry out off-line 
> phrase-searches of Wikipedia and to return a count of the number of hits for 
> each search. Typical phrase-searches might be "of the dog" and "dog's".

> I have some limited prior programming experience (from many years ago) and I 
> am currently learning Python from a course of YouTube tutorials. Before I get 
> much further, I wanted to ask:

> Is what I am trying to do actually feasible?

Cant really visualize what youve got...
When you 'download' wikipedia what do you get?
One 40GB file?
A zillion files?
Some other database format?

Another point:
sax is painful to use compared to full lxml (dom)
But then sax is the only choice when files cross a certain size
Thats why the above question

Also you may want to explore nltk
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wikipedia XML Dump

2014-01-28 Thread Skip Montanaro
> Another point:
> sax is painful to use compared to full lxml (dom)
> But then sax is the only choice when files cross a certain size
> Thats why the above question

No matter what the choice of XML parser, I suspect you'll want to
convert it to some other form for processing.

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


boost-python: exposing constructor with an array of other class as argument

2014-01-28 Thread Ester Lopez
Hello there,

I have two different classes that I want to expose using boost-python,
but the constructor of the second class takes and array of the first
one as argument and I can't figure out how to do it.

This is the definition of the classes:

class INT96{
public:
uint64_t value[3];
INT96(){};
INT96(uint64_t x0, uint64_t x1, uint64_t x2);
...
};
template 
class Xi_CW{
protected:
INT96 A[k];
public:
Xi_CW(INT96 (&A)[k]);
...
};

And my attempt to expose them using boost-python:

using namespace boost::python;
typedef Xi_CW<4> Xi_CW4;
BOOST_PYTHON_MODULE(xis)
{
class_("INT96", init())
[...]
;
class_("Xi_CW4", init())
[...]
;
}

Which results in a "no known conversion error". I've tried several
other possibilities but so far no luck...

Any idea how should I do it? Thanks

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


Documenting descriptors

2014-01-28 Thread Joseph L. Casale
I am documenting a few classes with Sphinx that utilize methods decorated
with custom descriptors. These properties return data when called and Sphinx
is content with a :returns: and :rtype: markup in the properties doc string.

They also accept input, but parameter (not really applicable) nor var markup
is accepted as valid?

Anyone know the trick here?

Thanks,
jlc
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Ned Batchelder

On 1/28/14 2:19 AM, wxjmfa...@gmail.com wrote:

Different, but a little bit related. The work
which is done actually on the possibility (not
implemented but alreay realized) to colorize (style")
the different graphemes of a glyph is very interesting.

Python with its absurd Flexible String Representation
just become a no go for the kind of task.

(Should not be too complicate to understand.)

jmf



JMF, seriously, stop it.  You've convinced no one because you have no 
convincing arguments.


It's obnoxious to continue to make this claim.  Stop it.  Please.

If you want to try to convince someone, convince me.  Write to me 
offline: n...@nedbatchelder.com


--
Ned Batchelder, http://nedbatchelder.com

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


Re: ANN: eGenix pyOpenSSL Distribution 0.13.3.1.0.1.6

2014-01-28 Thread Denis McMahon
On Tue, 28 Jan 2014 17:47:39 +0100, eGenix Team: M.-A. Lemburg wrote:

> It comes with an easy-to-use installer that includes the most recent
> OpenSSL library versions in pre-compiled form

Hmm, well it all sounds very good, but how would I know that the pre-
compiled library doesn't contain a backdoor that sends copies of all the 
plaintext to the NSA?

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


PyDev 3.3.3 Released

2014-01-28 Thread Fabio Zadrozny
Hi All,

PyDev 3.3.3 has been released

Details on PyDev: http://pydev.org

Details on its development: http://pydev.blogspot.com

LiClipse (PyDev standalone with goodies such as support for Django
Templates, Kivy Language, Mako Templates, Html, Javascript, etc):
http://brainwy.github.io/liclipse/


What is PyDev?
---

PyDev is a plugin that enables users to use Eclipse for Python, Jython and
IronPython development -- making Eclipse a first class Python IDE -- It
comes with many goodies such as code completion, syntax highlighting,
syntax analysis, code analysis, refactor, debug, etc.


Release Highlights:
---


* **Important**: PyDev requires Eclipse 3.8 or 4.3 onwards and Java 7! For
older versions, keep using PyDev 2.x (see LiClipse:
http://brainwy.github.io/liclipse for a PyDev standalone with all
requirements bundled).


* **Code Completion**:

- Compiled modules are now indexed and shown in the context-insensitive
code-completion.

- In an empty file, a code-completion request will show options related
to creating modules (press Ctrl+Space twice to show only those templates).


* **Performance**:

- Building (indexing) of Python files is **much** faster.

- Code completion does not get slown down by other analysis done in the
background due to shell synchronization.


* **Interactive Console**:

- The interactive console now has tab-completion (so, tab can be used
to show completions such as in IPython).


* **Debugger**:

- **Locals are now properly changed in the debugger** -- along with set
next statement and auto-reloading this can make a debug session much more
enjoyable!

- Added a way to skip functions on a step-in on functions with
**#@DontTrace** comments:

- **Makes it possible to skip a lot of boilerplate code on a debug
session!**
- Can be enabled/disabled in the debugger preferences;
- Ctrl+1 in a line with a method shows option to add
**#@DontTrace** comment (if enabled in the preferences).

- Debugging Stackless is much improved, especially for versions of
Stackless released from 2014 onwards (special thanks to Anselm Kruis who
improved stackless itself for this integration to work properly).

- Reload during a debug session is improved and more stable:

- Only updates what it can in-place or adds new attributes;

- Shows what's being patched in the console output;

- New hooks are provided for clients which may want to extend the
reload;

- See: Auto Reload in Debugger:
http://pydev.org/manual_adv_debugger_auto_reload.html for more details.



* **General**:

- Compiled modules are now indexed, so, **fix import with Ctrl+1 now
works with itertools, PyQt and other 'forced builtins'**.

- When diffing a Python file, the PyDev comparison (with proper syntax
highlighting) is now the default.

- When finding a definition in a .pyd file, if there's a related .pyx
in the same location, it's opened.

- Running unit-tests will not try to import files that are in folders
that don't have an __init__.py file.

- Alt+Shift+O can be used to toggle mark occurrences.

- Ctrl+3 not bound by default anymore on PyDev so that it does not
conflict with the Eclipse Ctrl+3 (Ctrl+/ can be used instead).

- Fixed recursion issue when finding file in pydev package explorer.

- When configuring the interpreter, links are not followed when
resolving entries for the PYTHONPATH.

- It's possible to launch a directory containing a __main__.py file
executable.

- Fixed issues when creating django project without any existing
project in the workspace.

- Fixed deadlock on code-completion.

- __pycache__ folders are hidden by default.


* **Organize imports**:

- When saving a file, if automatically organizing imports, don't remove
unused imports even if that option is checked.

- When saving a file, if automatically organizing imports, and nothing
changes, don't change the buffer (so, no undo command is created).

- @NoMove can be used in an import so that the import organizer doesn't
mess with it.



* **Refactoring**:

- Fixed error when moving resource in PYTHONPATH to a dir out of the
PYTHONPATH.

- On a search make sure we search only python files, not dlls (which
could give OutOfMemory errors and make the search considerably slower).

- Multiple fixes on the rename module refactoring.



Cheers,

--
Fabio Zadrozny
--
Software Developer

LiClipse
http://brainwy.github.io/liclipse

PyDev - Python Development Environment for Eclipse
http://pydev.org
http://pydev.blogspot.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Pyro4 - reading files

2014-01-28 Thread ganea . ionut . iulian
Hello there.

I am currently working on a project involving the use of Pyro4.

I have a scenario.

We have the pc named A, and a pc named B.

On pc B lies a python script, that includes pyro, and a method for reading 
files.

On pc A, we create an instance to the pyro object on pc B. And we call the 
method for reading files.

I want to read a file that lies on pc B, from pc A using the method of the pyro 
object i just created.

Is it possible?

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


Re: Highlighting program variables instead of keywords?

2014-01-28 Thread Michael Torrie
On 01/28/2014 12:38 PM, Ned Batchelder wrote:
> JMF, seriously, stop it.  You've convinced no one because you have no 
> convincing arguments.
> 
> It's obnoxious to continue to make this claim.  Stop it.  Please.
> 
> If you want to try to convince someone, convince me.  Write to me 
> offline: n...@nedbatchelder.com

JMF, maybe if you'd actually try to write a program in Python that does
what you are talking about with "colorizing graphemes," (whatever that
means) then you can talk.  Sounds to me like you don't even use Python
at all, for unicode or anything else.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wikipedia XML Dump

2014-01-28 Thread Kevin Glover
Thanks for the comments, guys. The Wikipedia download is a single XML document, 
43.1GB. Any further thoughts?

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


Re: Wikipedia XML Dump

2014-01-28 Thread Burak Arslan
hi,

On 01/29/14 00:31, Kevin Glover wrote:
> Thanks for the comments, guys. The Wikipedia download is a single XML 
> document, 43.1GB. Any further thoughts?
>
>

in that case, http://lxml.de/tutorial.html#event-driven-parsing seems to
be your only option.

hth,
burak
-- 
https://mail.python.org/mailman/listinfo/python-list


Development infrastructure - need python packaging gurus help, please

2014-01-28 Thread Eugene Sajine
Hi!

I'm trying to create a development infrastructure that would allow for simple 
and unified ways of sharing, *deploying* and *reusing* the code within private 
entity. I can see that pip with virtual environments and requirements.txt is 
very similar to dependency management provided by maven or apache ivy. But 
there seems to be a disconnect between the egg carrying the possibility to be 
importable and executable, but in the same time considered to be deprecated 
format which is not fully supported by pip and virtualenv and wheel not having 
those basic questions answered...

Here is what i'm trying to achieve:
1. I want to be able to specify the set of dependencies for the project i'm 
currently developing and make them available for the import. Think java jar - 
having it in class path allows for the code reuse (import packages provided) as 
well as for the execution.
2. I want to be able to put the newly created project in a form of artifact in 
a some central location from which it can be taken to be imported or executed 
or included into "class path". Again think java jar. If i have it in some 
location i can use ivy or maven to manage the dependencies and provide it to me 
upon request
3. I want to be able to deploy the program and execute it.

So the problem with all this as i see it:
The importable and executable format is egg, but it is deprecated!
Sane dependency management is pip and virtualenv, but they don't support eggs 
fully (pip install --egg is having the disclaimer that it s not working ok 
sometimes) wheel is pretty much unusable for anything other then installing 
into the virtualenv.

Am i missing something?

Thanks in advance,
Eugene
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Wikipedia XML Dump

2014-01-28 Thread alex23

On 28/01/2014 9:45 PM, kevinglove...@gmail.com wrote:

I have downloaded and unzipped the xml dump of Wikipedia (40+GB). I want to use Python and the SAX 
module (running under Windows 7) to carry out off-line phrase-searches of Wikipedia and to return a 
count of the number of hits for each search. Typical phrase-searches might be "of the 
dog" and "dog's".

I have some limited prior programming experience (from many years ago) and I am 
currently learning Python from a course of YouTube tutorials. Before I get much 
further, I wanted to ask:

Is what I am trying to do actually feasible?


Rather than parsing through 40GB+ every time you need to do a search, 
you should get better performance using an XML database which will allow 
you to do queries directly on the xml data.


http://basex.org/ is one such db, and comes with a Python API:

http://docs.basex.org/wiki/Clients

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


Re: Wikipedia XML Dump

2014-01-28 Thread Rustom Mody
On Wednesday, January 29, 2014 4:17:47 AM UTC+5:30, Burak Arslan wrote:
> hi,

> On 01/29/14 00:31, Kevin Glover wrote:
> > Thanks for the comments, guys. The Wikipedia download is a single XML 
> > document, 43.1GB. Any further thoughts?

> in that case, http://lxml.de/tutorial.html#event-driven-parsing seems to
> be your only option.

Further thoughts?? Just a combo of what Burak and Skip said:
I'd explore a thin veneer of even-driven lxml to get from 40 GB monolithic xml
to something (more) digestible to nltk
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Experiences/guidance on teaching Python as a first programming language

2014-01-28 Thread David Combs
In article <20131216213225.2006b30246e3a08ee241a...@gmx.net>,
Wolfgang Keller   wrote:
>> > And ever after that experience, I avoided all languages that were
>> > even remotely similar to C, such as C++, Java, C#, Javascript, PHP
>> > etc.
>> 
>> I think that's disappointing, for two reasons. Firstly, C syntax isn't
>> that terrible.
>
>It's not just the abysmally appalling, hideously horrifying syntax. At
>about everything about C is just *not* "made for human beings" imho.
>
>It's just an un-language that gets at about everything wrong. Sort of
>like Microsoft's products.
>
>Sincerely,
>
>Wolfgang
>

I don't see how you could create a better high-level LOW-LEVEL 
language.

And that pointer "*" syntax is really ingenious.  (After
all, the guys who created it and those who first used
it (at Bell Labs) WERE all geniuses!)

David

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


Re: Experiences/guidance on teaching Python as a first programming language

2014-01-28 Thread David Combs
In article ,
Neil Cerutti   wrote:
>On 2013-12-17, Steven D'Aprano
> wrote:
>> I would really like to see good quality statistics about bugs
>> per program written in different languages. I expect that, for
>> all we like to make fun of COBOL, it probably has few bugs per
>> unit-of-useful-work-done than the equivalent written in C.
>
>I can't think of a reference, but I to recall that
>bugs-per-line-of-code is nearly constant; it is not language
>dependent. So, unscientifically, the more work you can get done
>in a line of code, then the fewer bugs you'll have per amount of
>work done.
>
>-- 
>Neil Cerutti
>

Makes no sense to me.

I can't imagine that errors per 100 lines is anywhere
near as high with a language that has garbage collection
and type checking as with one that has neither.

David

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


Re: Enable unicode

2014-01-28 Thread Cameron Simpson
On 29Jan2014 02:47, Ben Finney  wrote:
> Igor Korot  writes:
> > On Tue, Jan 28, 2014 at 1:00 AM, Chris Angelico  wrote:
> > > Hi! I'm hoping it was oversight that led to this email coming to me
> > > personally instead of to the list, and hoping that you won't mind me
> > > responding on-list.
> >
> > Sorry about that.
> > I keep forgetting that gmail web mail is stupid and does not use the
> > list address on "Reply".
[...]
> Instead, for replying to a list, you need the “reply to list” command
> http://david.woodhou.se/reply-to-list.html>. Sadly, it appears
> GMail does not have this command; you may want to use a better mail
> client which implements this feature.

For example, choose and use a real desktop mail client and
connect to GMail's IMAP interface. At least then you can pick
something with the feature set you want.
-- 
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Large Two Dimensional Array

2014-01-28 Thread Ayushi Dalmia
Hello,

I am trying to implement IBM Model 1. In that I need to create a matrix of 
5*5 with double values. Currently I am using dict of dict but it is 
unable to support such high dimensions and hence gives memory error. Any help 
in this regard will be useful. I understand that I cannot store the matrix in 
the RAM but what is the most efficient way to do this?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Large Two Dimensional Array

2014-01-28 Thread Ayushi Dalmia
On Wednesday, January 29, 2014 10:55:54 AM UTC+5:30, Ayushi Dalmia wrote:
> Hello,
> 
> 
> 
> I am trying to implement IBM Model 1. In that I need to create a matrix of 
> 5*5 with double values. Currently I am using dict of dict but it is 
> unable to support such high dimensions and hence gives memory error. Any help 
> in this regard will be useful. I understand that I cannot store the matrix in 
> the RAM but what is the most efficient way to do this?

Also, the matrix indices are words and not integers. I donot want to map.
-- 
https://mail.python.org/mailman/listinfo/python-list


Eclipse IDE printing values automatically

2014-01-28 Thread mick verdu
I am using Pydev 2.8 on Eclipse IDE. It is printing some values that haven't 
been printed with print command. How to deal with this problem?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Large Two Dimensional Array

2014-01-28 Thread David Froger
Quoting Ayushi Dalmia (2014-01-29 06:25:54)
> Hello,
> 
> I am trying to implement IBM Model 1. In that I need to create a matrix of 
> 5*5 with double values. Currently I am using dict of dict but it is 
> unable to support such high dimensions and hence gives memory error. Any help 
> in this regard will be useful. I understand that I cannot store the matrix in 
> the RAM but what is the most efficient way to do this?
> -- 
> https://mail.python.org/mailman/listinfo/python-list

Hello,

I would suggest using h5py [1] or PyTables [2] to store data on disk (both are
based on HDF5 [3]), and manipulate data in RAM as NumPy [4] arrays.

[1] www.h5py.org
[2] www.pytables.org
[3] www.hdfgroup.org/HDF5
[4] www.numpy.org
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Development infrastructure - need python packaging gurus help, please

2014-01-28 Thread dieter
Eugene Sajine  writes:
> ...
> Here is what i'm trying to achieve:
> 1. I want to be able to specify the set of dependencies for the project i'm 
> currently developing and make them available for the import. Think java jar - 
> having it in class path allows for the code reuse (import packages provided) 
> as well as for the execution.
> 2. I want to be able to put the newly created project in a form of artifact 
> in a some central location from which it can be taken to be imported or 
> executed or included into "class path". Again think java jar. If i have it in 
> some location i can use ivy or maven to manage the dependencies and provide 
> it to me upon request
> 3. I want to be able to deploy the program and execute it.

You may have a look at "zc.buildout" - it may support your
development needs.

Once the development is complete, a so called "meta-egg" may
be used to describe the finished program. A "meta-egg" does not
have (significant amounts of) code but essentially states
dependencies of other eggs.

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


Re: Large Two Dimensional Array

2014-01-28 Thread Ayushi Dalmia
On Wednesday, January 29, 2014 10:55:54 AM UTC+5:30, Ayushi Dalmia wrote:
> Hello,
> 
> 
> 
> I am trying to implement IBM Model 1. In that I need to create a matrix of 
> 5*5 with double values. Currently I am using dict of dict but it is 
> unable to support such high dimensions and hence gives memory error. Any help 
> in this regard will be useful. I understand that I cannot store the matrix in 
> the RAM but what is the most efficient way to do this?

Thanks David!
-- 
https://mail.python.org/mailman/listinfo/python-list