TextTest 3.26 - blackbox testing tool

2013-11-04 Thread Geoff Bache
Dear all,

There are many enhancements and bug fixes, notably
- Performance improvements for large test suites, particularly Saving
- Config tab has file management context menu now similar to Test tab
- Jenkins integration more reliable and informative
- Various knownbugs enhancements

Regards,
Geoff Bache

TextTest is a tool for automatic text-based functional testing. This
means running a batch-mode executable in lots of different ways from
the command line, and using the text output produced as a means of
controlling the behavior of that application. As well as being usable
standalone, it is an extendable framework for black-box testing
written in Python. It's also useful as a test management tool wrapping
some other test tool as a test runner.

Homepage: http://www.texttest.org
Download: http://sourceforge.net/projects/texttest
Mailing list: https://lists.sourceforge.net/lists/listinfo/texttest-users
Bugs: https://bugs.launchpad.net/texttest
Source: https://code.launchpad.net/texttest
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


[ANN] ftputil 3.0b released

2013-11-04 Thread Stefan Schwarzer
ftputil 3.0b is now available from
http://ftputil.sschwarzer.net/download .

Changes since version 2.8
-

Note: This version of ftputil is _not_ backward-compatible
with earlier versions.See the links below for information
on adapting existing client code.

- This version adds Python 3 compatibility! :-)

  The same source is used for Python 2.x and Python 3.x.

  I had to change the API to find a good compromise for
  both Python versions.

- ftputil now requires at least Python 2.6.

- Remote file-like objects use the same semantics as Python's
  `io` module. (This is the same as for the built-in `open`
  function in Python 3.)

- `ftputil.ftp_error` was renamed to `ftputil.error`.

- For custom parsers, import `ftputil.parser` instead of
  `ftputil.stat`.

For more information please read
http://ftputil.sschwarzer.net/trac/wiki/WhatsNewInFtputil3.0
http://ftputil.sschwarzer.net/trac/wiki/PreReleaseDocumentation

What is ftputil?


ftputil is a high-level FTP client library for the Python programming
language. ftputil implements a virtual file system for accessing FTP
servers, that is, it can generate file-like objects for remote files.
The library supports many functions similar to those in the os,
os.path and shutil modules. ftputil has convenience functions for
conditional uploads and downloads, and handles FTP clients and servers
in different timezones.

License
---

ftputil is Open Source software, released under the revised BSD
license (see http://opensource.org/licenses/BSD-3-Clause ).

Stefan

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

Support the Python Software Foundation:
http://www.python.org/psf/donations/


ANN: rom 0.22 - Redis object mapper for Python

2013-11-04 Thread Josiah Carlson
Hey everyone,

As time progresses, so does my Redis object mapper.

The rom package is a Redis object mapper for Python. It sports an
interface similar to Django's ORM, SQLAlchemy + Elixir, or Appengine's
datastore.

The changelog for recent releases can be seen below my signature.

You can find the package at:
https://www.github.com/josiahcarlson/rom
https://pypi.python.org/pypi/rom

And docs can be found at:
http://pythonhosted.org/rom/

Please CC me on any replies if you have any questions or comments.

Thank you,
 - Josiah

#--- 0.22

[fixed] size estimation for intersection ordering when filtering has now
been
fixed, thank you to https://github.com/MickeyKim for the report and the
change (should improve performance).
[fixed] an issue with some types when trying to update attributes has now
been
fixed, thank you to https://github.com/denisvolokh for the report.
[changed] improved performance for simple numeric range queries of the form
Model.get_by(attr=value) or Model.get_by(attr=(min, max)) by roughly a
factor of 60x or better in some cases. Thank you to
https://github.com/MickeyKim for the report on poor performance.
#--- 0.21

[fixed] upload for rom 0.20 was missing new columns.py, now fixed
#--- 0.20

[changed] Added exception when performing .all(), .execute(), or .count() on
query objects that have had no filters or attribute ordering provided.
This addresses issue #12.
[changed] Moved column definitions to their own module, shouldn't affect any
normal uses of rom.
[added] For users of Redis 2.6 and later, there is a beta Lua-enabled
writing
option that allows for multiple unique columns on models. In some cases,
this may improve performance when writing many entities very quickly.
[added] The ability to reload an entity from Redis, optionally discarding
any
modifications to the object itself. Check out the documentation for
Model.refresh(), Session.refresh(), and Session.refresh_all()
[added] Tests for the newly changed/added features.
[changed] Tests no longer use flushdb() - all test models/indexes/etc. are
prefixed with RomTest, and we find/delete such keys before and after any
tests are run. Now anyone can reasonably run the test suite.
#--- 0.19

[fixed] Thanks to a bug report by https://github.com/MickeyKim , was
notified
of a bug when using unique indexes, which is now fixed and has a
testcase.
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


StoryText 3.10 - GUI testing tool

2013-11-04 Thread Geoff Bache
Hi all,

The 3.10 release features the following:
- Many enhancements for SWT/Eclipse and wxPython.
- Some general new features also, mostly in the editor.

Regards,
Geoff Bache

A bit more detail:

StoryText is an unconventional GUI testing tool for PyGTK, Tkinter,
wxPython, Swing and SWT along with a Python framework for testing GUIs
in general.

Instead of recording GUI mechanics directly, it asks the user for
descriptive names and hence builds up a domain language along with a
UI map file that translates this language into actions on the
current GUI widgets. The point is to reduce coupling, allow very
expressive tests, and ensure that GUI changes mean changing the UI map
file but not all the tests.

Instead of an assertion mechanism, it auto-generates a log of the
GUI appearance and changes to it. The point is then to use that as a
baseline for text-based testing, using TextTest.

It also includes support for instrumenting code so that waits can be
recorded, making it far easier for a tester to record correctly
synchronized tests without having to explicitly plan for this.

Homepage: http://www.texttest.org/index.php?page=ui_testing
Download: http://sourceforge.net/projects/pyusecase
Mailing list: https://lists.sourceforge.net/lists/listinfo/texttest-users
Bugs: https://bugs.launchpad.net/storytext/
Source: https://code.launchpad.net/stohttps://code.launchpad.net/storytext/
rytext
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

Support the Python Software Foundation:
http://www.python.org/psf/donations/


Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-11-04 Thread Antoon Pardon
Op 03-11-13 23:11, Ben Finney schreef:
 Antoon Pardon antoon.par...@rece.vub.ac.be writes:
 
 Op 03-11-13 06:17, Steven D'Aprano schreef:
 I'm trying hard to give up threads like this, where people debate
 the subjective tone of an email and ever more pedantic arguments
 about the precise wording. Even when all participants are arguing in
 good faith, they risk becoming quagmires which go nowhere in dozens
 of posts.

 So it seems you want this to be a welcoming community, as long as we
 don't propose you to change your own behaviour.
 
 We aim to be a community that always welcomes diversity of people. This
 does not entail always welcoming bad behaviour.

But the question was whether some behaviour of steve himself was
contributing or in conflict with his aim.

 Steven is aiming to change his behaviour to make the community more
 welcoming of people: he is aiming to cease contributing to threads where
 the bad behaviour is an interminable discussion of tone and pedantry.
 This is, as I see it, wholly compatible with making the community more
 welcoming to people, by reducing the volume of such threads.

Sorry but from my side that sounds awefully convenient. When the
behaviour of others is questionable, they undermine the welcoming
atmosphere of the community. When Steves behaviour is questionable the
others are behaving badly by discussing tone and pedantry.

This is a typical: Heads, I win, Tail, you lose situation that is
being set up.

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


Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-11-04 Thread Ben Finney
Antoon Pardon antoon.par...@rece.vub.ac.be writes:

 This is a typical: Heads, I win, Tail, you lose situation that is
 being set up.

If you see a discussion as a zero-sum game – like a coin toss, where one
person's win can only be at the expense of someone else's loss – then I
fear this isn't going to be productive.

Suffice it to say that any number of parties can be behaving badly in a
discussion. If one person declares their choice not to continue an
unhelpful discussion, that does does not mean that they declare victory,
nor that they declare defeat. Discussions that are about “winning” or
“losing” the discussion are pretty futile in this forum anyway.

-- 
 \  “The only tyrant I accept in this world is the still voice |
  `\ within.” —Mohandas Gandhi |
_o__)  |
Ben Finney

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


Re: Automation

2013-11-04 Thread Mark Lawrence

On 04/11/2013 00:16, bob gailer wrote:

Let's remember that it is the job of the OP to explain his problem so we
can offer solutions.



It's also the job of the responder to help if possible, e.g. by 
providing some context with their messages, which is clearly absent above.


--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: Python Practice Problems

2013-11-04 Thread Terry Reedy

On 11/4/2013 12:28 AM, memilanuk wrote:

On 11/03/2013 06:06 PM, yungwong@gmail.com wrote:

Hi, who has some problems to practice using Python?
Thx a lot!



http://projecteuler.net/ is always a good bet


Also www.checkio.org


--
Terry Jan Reedy

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


Re: Possibly better loop construct, also labels+goto important and on the fly compiler idea.

2013-11-04 Thread Antoon Pardon
Op 04-11-13 10:07, Ben Finney schreef:
 Antoon Pardon antoon.par...@rece.vub.ac.be writes:
 
 This is a typical: Heads, I win, Tail, you lose situation that is
 being set up.
 
 If you see a discussion as a zero-sum game – like a coin toss, where one
 person's win can only be at the expense of someone else's loss – then I
 fear this isn't going to be productive.

I don't see it that way. My point is that Steve seems to work hard
creating the impression that he does see it that way. My impression
is that Steve is not that much interrested in a welcoming group as
he is interrested in a group where he himself feels at ease. Where
the two coincide, he argues for a welcoming group. Where the two
may be in conflict, he is more interested in defending his behaviour
or brushing it of than he is in contributing to a welcoming group.

 Suffice it to say that any number of parties can be behaving badly in a
 discussion. If one person declares their choice not to continue an
 unhelpful discussion, that does does not mean that they declare victory,
 nor that they declare defeat. Discussions that are about “winning” or
 “losing” the discussion are pretty futile in this forum anyway.

Unhelpful for whom? My thought is that a welcoming group is able to
resolve or a least discuss conflicts. If you declare the discussion
not helpful and see that as a reason not to continue with it, you
are IMO not contributing to such a group. With the numerous times
Steve told the rest about how he wants a welcoming group, he doesn't
seem that much interrested in actually doing an effort himself.

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


install package from github repository

2013-11-04 Thread C. Ng
Hi,

I have cloned someone's repository on my local drive using git command:
git clone http://github.com/xxx.git

But I don't find any setup.py file. How do I install the package xxx? So that I 
can 'import xxx' in my python script. 

Many thanks.



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


Re: install package from github repository

2013-11-04 Thread Amirouche Boubekki
create a setup.py and install it


2013/11/4 C. Ng ngc...@gmail.com

 Hi,

 I have cloned someone's repository on my local drive using git command:
 git clone http://github.com/xxx.git

 But I don't find any setup.py file. How do I install the package xxx? So
 that I can 'import xxx' in my python script.

 Many thanks.



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

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


Re: Automation

2013-11-04 Thread Denis McMahon
On Sun, 03 Nov 2013 23:32:46 +, Denis McMahon wrote:

 On Sun, 03 Nov 2013 14:19:48 -0200, Renato Barbosa Pim Pereira wrote:
 
 I have one .xls file with the values of PV MV and SP, I wanna to
 calculate Kp Ki Kd with python from this file, can anyone give me any
 suggestion about how can I do this? From now, thanks.
 
 Why use Python? Why not simply write excel to do the calculations?
 
 Assuming PV, MV and SP are in columns, you simply need to write your
 equations for Kp, Ki and Kd so that they reference the relevant columns,
 and then past them down the whole spreadsheet.
 
 Seems to me like you're using a sledgehammer to shell a peanut.

For some reason OP is now continuing the conversation with my by email 
and adding me to his social networks.

To the OP - observation - in the original post you said .xls file, 
not .csv file. If your data is in .csv format, you should have said so, 
not called it an .xls file.

If you ant to convert your .csv containing columns a, b and c into a .csv 
containing columns a, b, c, x, y and z, then the solution is to read your 
existing .csv file one line at a time, calculate the extra values x, y 
and z, and then write the 6 values to a new file.

You might want to delete the old file and rename the new one to the old 
name when you finish, that might be part of the implementation 
requirements.

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


Re: install package from github repository

2013-11-04 Thread Chris Angelico
On Mon, Nov 4, 2013 at 8:56 PM, C. Ng ngc...@gmail.com wrote:
 Hi,

 I have cloned someone's repository on my local drive using git command:
 git clone http://github.com/xxx.git

 But I don't find any setup.py file. How do I install the package xxx? So that 
 I can 'import xxx' in my python script.

Does the package have installation instructions? Look for a README or similar.

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


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Tim Chase
On 2013-11-03 19:40, Mark Janssen wrote:
 But you cheated by using a piece of information from outside the
 system: length.  A generic compression algorithm doesn't have this
 information beforehand.

By cheating with outside information, you can perfectly compress any
one data-set down to 1 bit.  Just store the data in the program, then
store 1 bit of is this file the data we have stored in the
program?.  Granted, in modern OSes, you waste 7 extra bits since
they require you to write an entire byte at a time. :-)

And with that, you could even have an empty file and test for a file
extension. ;-)

-tkc



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


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread jonas . thornvall
Den lördagen den 2:e november 2013 kl. 22:31:09 UTC+1 skrev Tim Roberts:
 jonas.thornv...@gmail.com wrote:
 
 
 
 Well then i have news for you.
 
 
 
 Well, then, why don't you share it?
 
 
 
 Let me try to get you to understand WHY what you say is impossible.  Let's
 
 say you do have a function f(x) that can produce a compressed output y for
 
 any given x, such that y is always smaller than x.  If that were true, then
 
 I could call f() recursively:
 
 f(f(...f(f(f(f(f(x)...))
 
 and eventually the result get down to a single bit.  I hope it is clear
 
 that there's no way to restore a single bit back into different source
 
 texts.
 
 
 
 Here's another way to look at it.  If f(x) is smaller than x for every x,
 
 that means there MUST me multiple values of x that produce the same f(x).
 
 Do you see?  If x is three bits and f(x) is two bits, that means there are
 
 8 possible values for x but only 4 values for f(x).  So, given an f(x), you
 
 cannot tell which value of x it came from.  You have lost information.
 
 -- 
 
 Tim Roberts, t...@probo.com
 
 Providenza  Boekelheide, Inc.

Well let me try to explain why it is working and i have implemented one.
I only need to refresh my memory it was almost 15 years ago.
This is not the solution but this is why it is working.
65536=256^2=16^4=***4^8***=2^16

Yes i am aware that 256 is a single byte 8 bits, but the approach is valid 
anyway.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread jonas . thornvall
Den måndagen den 4:e november 2013 kl. 14:53:28 UTC+1 skrev 
jonas.t...@gmail.com:
 Den lördagen den 2:e november 2013 kl. 22:31:09 UTC+1 skrev Tim Roberts:
 
  jonas.thornv...@gmail.com wrote:
 
  
 
  
 
  
 
  Well then i have news for you.
 
  
 
  
 
  
 
  Well, then, why don't you share it?
 
  
 
  
 
  
 
  Let me try to get you to understand WHY what you say is impossible.  Let's
 
  
 
  say you do have a function f(x) that can produce a compressed output y for
 
  
 
  any given x, such that y is always smaller than x.  If that were true, then
 
  
 
  I could call f() recursively:
 
  
 
  f(f(...f(f(f(f(f(x)...))
 
  
 
  and eventually the result get down to a single bit.  I hope it is clear
 
  
 
  that there's no way to restore a single bit back into different source
 
  
 
  texts.
 
  
 
  
 
  
 
  Here's another way to look at it.  If f(x) is smaller than x for every x,
 
  
 
  that means there MUST me multiple values of x that produce the same f(x).
 
  
 
  Do you see?  If x is three bits and f(x) is two bits, that means there are
 
  
 
  8 possible values for x but only 4 values for f(x).  So, given an f(x), you
 
  
 
  cannot tell which value of x it came from.  You have lost information.
 
  
 
  -- 
 
  
 
  Tim Roberts, t...@probo.com
 
  
 
  Providenza  Boekelheide, Inc.
 
 
 
 Well let me try to explain why it is working and i have implemented one.
 
 I only need to refresh my memory it was almost 15 years ago.
 
 This is not the solution but this is why it is working.
 
 65536=256^2=16^4=***4^8***=2^16
 
 
 
 Yes i am aware that 256 is a single byte 8 bits, but the approach is valid 
 anyway.

You see if the program behave intelligent some small operations can perform 
wonder on a number.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Dave Angel
On Mon, 4 Nov 2013 05:53:28 -0800 (PST), jonas.thornv...@gmail.com 
wrote:
Den lördagen den 2:e november 2013 kl. 22:31:09 UTC+1 skrev Tim 

Roberts:
 Here's another way to look at it.  If f(x) is smaller than x for 

every x,




 that means there MUST me multiple values of x that produce the 

same f(x).




 Do you see?  If x is three bits and f(x) is two bits, that means 

there are




 8 possible values for x but only 4 values for f(x).  So, given an 

f(x), y=




 cannot tell which value of x it came from.  You have lost 

information.




Well let me try to explain why it is working and i have implemented 

one.

I only need to refresh my memory it was almost 15 years ago.
This is not the solution but this is why it is working.
65536=256^2=16^4=***4^8***=2^16



Yes i am aware that 256 is a single byte 8 bits, but the approach 

is valid =

anyway.


And e ^ (I * pi) == -1
So what. ?

Better file that patent, before the patent office realizes the 
analogy to the perpetual motion machine.


--
DaveA

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


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread rusi
On Monday, November 4, 2013 7:57:19 PM UTC+5:30, Dave Angel wrote:
 On Mon, 4 Nov 2013 05:53:28 -0800 (PST), Jonas wrote:
  Well let me try to explain why it is working and i have implemented one.
  I only need to refresh my memory it was almost 15 years ago.
  This is not the solution but this is why it is working.
  65536=256^2=16^4=***4^8***=2^16

  Yes i am aware that 256 is a single byte 8 bits, but the approach 
  is valid anyway.

 And e ^ (I * pi) == -1
 So what. ?

 Better file that patent, before the patent office realizes the 
 analogy to the perpetual motion machine.

Now I am too much of a dim-wit to comprehend all this compressified
profundification but I think I have a (dim) clue how such a patent
will be obtained:

Just make a submission in such an unreadable double (then triple,
quadruple...) spaced format that the patent office will grant it in
exasperation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Slicing with negative strides

2013-11-04 Thread Steven D'Aprano
On Mon, 04 Nov 2013 00:15:40 +0100, Martin Manns wrote:

 On 29 Oct 2013 05:22:00 GMT
 Steven D'Aprano st...@pearwood.info wrote:
 
 Does anyone here use slices (or range/xrange) with negative strides
 other than -1?
 
 I have used negative strides for comparing discrete sequences e. g. for
 turbulence analysis, and I hope that my code will still run in Python 4.

Can you show us a typical example of how you would normally use such 
negative strides?


Thanks,



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


Re: [Python-ideas] os.path.join

2013-11-04 Thread Chris Angelico
On Tue, Nov 5, 2013 at 2:29 AM, anatoly techtonik techto...@gmail.com wrote:
 Right. But I am working more with URL paths nowadays. In there if I
 want to join two paths, no matter if 2nd starts with slash or not, I
 don't really expect the 2nd to rewrite the first.

Then os.path.join is probably the wrong tool for the job. Do you want
to collapse /foo/bar + ../quux into /foo/quux? That rewrites the
first. If not, don't use a function that does that. Try simple string
concatenation instead.

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


Re: [Python-ideas] os.path.join

2013-11-04 Thread Chris Angelico
Blargh, wrong list. It should have been private anyway. Kindly take no
notice of the man behind the 3AM clock...

ChrisA

On Tue, Nov 5, 2013 at 3:07 AM, Chris Angelico ros...@gmail.com wrote:
 On Tue, Nov 5, 2013 at 2:29 AM, anatoly techtonik techto...@gmail.com wrote:
 Right. But I am working more with URL paths nowadays. In there if I
 want to join two paths, no matter if 2nd starts with slash or not, I
 don't really expect the 2nd to rewrite the first.

 Then os.path.join is probably the wrong tool for the job. Do you want
 to collapse /foo/bar + ../quux into /foo/quux? That rewrites the
 first. If not, don't use a function that does that. Try simple string
 concatenation instead.

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


Re: [Python-ideas] os.path.join

2013-11-04 Thread Ethan Furman

On 11/04/2013 08:07 AM, Chris Angelico wrote:

On Tue, Nov 5, 2013 at 2:29 AM, anatoly techtonik techto...@gmail.com wrote:

Right. But I am working more with URL paths nowadays. In there if I
want to join two paths, no matter if 2nd starts with slash or not, I
don't really expect the 2nd to rewrite the first.


Then os.path.join is probably the wrong tool for the job. Do you want
to collapse /foo/bar + ../quux into /foo/quux? That rewrites the
first. If not, don't use a function that does that. Try simple string
concatenation instead.


Wrong mailing list.  ;)

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


Re: How to add a current string into an already existing list

2013-11-04 Thread Nick the Gr33k

Στις 3/11/2013 2:16 μμ, ο/η Roy Smith έγραψε:

In article bdm7fif28r...@mid.individual.net,
  Gregory Ewing greg.ew...@canterbury.ac.nz wrote:


Nick the Gr33k wrote:

I just want a mysql column type that can be eligible to store an array
of elements, a list that is, no need for having a seperate extra table
for that if we can have a column that can store a list of values.


Relational database systems typically don't provide any
such type, because it's not the recommended way of storing
that kind of data in a relational database.

The recommended way is to use a secondary table, as has
been pointed out.


Most SQL databases allow you to store arbitrary data as an opaque value
(i.e. BLOB).  So, one possibility would be to just serialize your list
(pickle, json, whatever) and store it that way.  I've seen databases
that didn't use BLOB, but just stored json in a string field.

The limitation, of course, is that the data is opaque as far as the
database goes; you can't do queries against it.  But, if all you need to
do is store the list and be able to retrieve it, it's a perfectly
reasonable thing to do, and a lot more efficient than doing a join on a
secondary table.

Normalization is for database weenies :-)



Exactly my sentiments Roy!

Call me picky but even if they try to hit me hard i wll always get to 
pick the simplest and better looking way.



I have managed to make my code work by:


create table visitors
(
  counterID integer(5) not null,
  host varchar(50) not null,
  refs varchar(25) not null,
  city varchar(20) not null,
  userOS varchar(10) not null,
  browser varchar(10) not null,
  visits datetime not null,
  hits integer(5) not null default 1,
  downloads varchar(50) not null default '',
  foreign key (counterID) references counters(ID),
  unique index (visits)
 )ENGINE = MYISAM;


=
# add this visitor entry into database (hits  downloads are defaulted)
cur.execute('''INSERT INTO visitors (counterID, refs, host, city, 
useros, browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s)''',  (cID, 
ref, host, city, useros, browser, lastvisit) )

=

and later on 

=
torrents = []
# check if visitor has downloaded movies
for download in downloads:
if download != '':
torrents.append( download )

# present visitor's movie picks if any
if torrents:
print( 'tdselect' )
for n, torrent in enumerate( torrents ):
if n == 0:
op_selected = 'selected'
else:
op_selected = ''
print( 'option %s %s /option' % (op_selected, torrent) )
print( '/select/td' )
else:
	print( 'tdcenterbfont color=white Δεν πραγματοποίηθηκαν ακόμη! 
/td' )

break
=


Please since this column you mentioned is able to store a Python's list 
datatype could you tell me what needs alternation in:


1. MySQL's visitor's table definition time
2. python database cur.execute method
3. retrieval time

Thank you very much for anyone wishes to give me a hand here.

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


Compiling Python3 for BeagleBone Black (Angstrom distro)

2013-11-04 Thread Travis Griggs
I'm playing with a BeagleBone Black running the angstrom distro. Of course, 
stock python is 2.7, I'd rather use python3. There isn't a python3 package 
available for angstrom. So I downloaded the source and compiled. It seemed to 
work pretty well. I used the basic approach outlined in the REAMDE:

./configure
make
make test
make install

Now, I want to repeat the process, but be a little more judicious about what 
all is compiled. For example, I don't really need tk stuff (in fact, it just 
kept telling me it wasn't there). And there's probably a number of other 
modules/libraries in the kitchen sink known as the stock install, that I could 
forgo on a tiny little computer like this.

I see, looking at ./configure --help | less, that I could provide 
--disable-FEATURE and --without-PACKAGE directives to my ./configure 
invocation. But what I don't see is how to generate a list of what 
FEATURES/PACKAGES I could put there for consideration of omission. Is there 
some magic juju that generates that?

Travis Griggs
--I multiply all estimates by tau to account for running around in circles
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] os.path.join

2013-11-04 Thread random832
On Mon, Nov 4, 2013, at 11:07, Chris Angelico wrote:
 Then os.path.join is probably the wrong tool for the job. Do you want
 to collapse /foo/bar + ../quux into /foo/quux? That rewrites the
 first. If not, don't use a function that does that. Try simple string
 concatenation instead.

 posixpath.join('/foo/bar','../quux')
'/foo/bar/../quux'
 macpath.join('foo:bar','::quux')
'foo:bar::quux'

The old mac module (and VMS if it existed) demonstrates join does more
than simply put two things together with sep between (also neatly
demonstrating why simple string concatenation is not a viable
solution), so this is clearly deliberate behavior rather than something
that merely falls out of a naive implementation as one could assume
the posix one to be.

I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] os.path.join

2013-11-04 Thread rusi
On Monday, November 4, 2013 9:47:18 PM UTC+5:30, Chris Angelico wrote:
 Blargh, wrong list. It should have been private anyway. Kindly take no
 notice of the man behind the 3AM clock...
 
 
 ChrisA

Ive got a little list Ive got a little list
For Australians of all kinds Ive got a little list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: [Python-ideas] os.path.join

2013-11-04 Thread Ethan Furman

On 11/04/2013 09:29 AM, random...@fastmail.us wrote:


I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').


Open a bug report.  :)

http://bugs.python.org

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


Re: [Python-ideas] os.path.join

2013-11-04 Thread Mark Lawrence

On 04/11/2013 17:34, Ethan Furman wrote:

On 11/04/2013 09:29 AM, random...@fastmail.us wrote:


I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').


Open a bug report.  :)

http://bugs.python.org

--
~Ethan~


Before or after it's been discussed on Python ideas? :)

--
Python is the second best programming language in the world.
But the best has yet to be invented.  Christian Tismer

Mark Lawrence

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


Re: [Python-ideas] os.path.join

2013-11-04 Thread Serhiy Storchaka

04.11.13 20:01, Mark Lawrence написав(ла):

On 04/11/2013 17:34, Ethan Furman wrote:

On 11/04/2013 09:29 AM, random...@fastmail.us wrote:


I did, incidentally, notice a bug in macpath's *split* function;
macpath.split(':foo::bar') should return (':foo::','bar') rather than
(':foo:','bar').


Open a bug report.  :)

http://bugs.python.org

--
~Ethan~


Before or after it's been discussed on Python ideas? :)


Instead.

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


Auto-authorization for Google Drive using Python in Mac OS X

2013-11-04 Thread Pratik Mehta
I have written Python code for Google Drive which uploads the image files to my 
drive app. I have three queries. Here is my code:

#!/usr/bin/python

import httplib2
import pprint

from apiclient.discovery import build
from apiclient.http import MediaFileUpload
from oauth2client.client import OAuth2WebServerFlow
from apiclient import errors
import sys


CLIENT_ID = 'CLIENT_ID'
CLIENT_SECRET = 'CLIENT_SECRET'

OAUTH_SCOPE = ['https://www.googleapis.com/auth/drive.readonly', 
'https://www.googleapis.com/auth/drive.file']

REDIRECT_URI = 'urn:ietf:wg:oauth:2.0:oob'

FILENAME = filepath/filename.png

flow = OAuth2WebServerFlow(CLIENT_ID, CLIENT_SECRET, OAUTH_SCOPE, REDIRECT_URI)
flow.params['access_type'] = 'offline'
flow.params['approval_prompt'] = 'force'
authorize_url = flow.step1_get_authorize_url()
print 'Go to the following link in your browser: ' + authorize_url
code = raw_input('Enter verification code: ').strip()

credentials = flow.step2_exchange(code)

http = httplib2.Http()
http = credentials.authorize(http)

drive_service = build('drive', 'v2', http=http)

media_body = MediaFileUpload(FILENAME, mimetype='image/png', resumable=True)
body = {
'title': 'Screen Shot 2013-11-03 at 3.54.08 AM',
'description': 'A test screenshot',
'mimeType': 'image/png'
}

file = drive_service.files().insert(body=body, media_body=media_body).execute()

new_permission = {
  'type': 'anyone',
  'role': 'reader'
}

try:
drive_service.permissions().insert(
fileId=file['id'], body=new_permission).execute()
except errors.HttpError, error:
print 'An error occurred: %s' % error

pprint.pprint(file)



My Queries:

1. This program will upload all the images to my given client_id and 
client_secret.
How do I make users to use my app and upload their images to their own Google 
Drive?

2. I want to automate this task. Whenever I run this application in terminal, 
it always asks me for the authorization code, which I don't want. Can this be 
bypassed?

3. I read about refresh_tokens, but couldn't find how can I implement this in 
my app for automating the authorization.
So, is refresh_tokens used for that? If yes, then how do I implement it in my 
program?
If not, then how can I make sure that as soon as my application is loaded, that 
particular file gets uploaded on google drive directly, without any 
authorization, or with any auto-authorization way, so that user interaction is 
chucked completely.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Compiling Python3 for BeagleBone Black (Angstrom distro)

2013-11-04 Thread Amirouche Boubekki
Hi Travis,

I see, looking at ./configure --help | less, that I could provide
 --disable-FEATURE and --without-PACKAGE directives to my ./configure
 invocation. But what I don't see is how to generate a list of what
 FEATURES/PACKAGES I could put there for consideration of omission. Is there
 some magic juju that generates that?


I don't remember correctly, I think it's a environment variable, also there
was a bug in python 2.7 regarding this...

Have a look at the setup.py of your python version there is some juju magic
mojo variable that configures the compiled extensions [1]

Also, whenever you want to compile something check gentoo ebuild aka.
compilation recipe, for instance for Python
3.3.2http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.3.2-r2.ebuild?revision=1.6view=markupor
linux
from scratch http://www.linuxfromscratch.org/lfs/.

Distcc might be helpful.


[1]
http://sources.gentoo.org/cgi-bin/viewvc.cgi/gentoo-x86/dev-lang/python/python-3.2.3.ebuild?view=markup
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python and Google App intergration

2013-11-04 Thread Amirouche Boubekki
Héllo,


Look for Google Apps APIs. I'm not sure what you want to do is possible, at
least manipulating the spreadsheet is doable from Pythonl:

http://stackoverflow.com/questions/2377301/how-to-write-a-python-script-to-manipulate-google-spreadsheet-data


2013/11/4 caseyc...@google.com

 I don't know Python well.  Only recently started taking the
 Codeacademy.com class.
 Is there a way to take input from a Google Spreadsheet and use it to add
 membership to a Google Group?
 If not Python, is there another language that could perform this function?
 --
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Python Practice Problems

2013-11-04 Thread Amirouche Boubekki
https://github.com/amirouche/1001-Projects


2013/11/4 Terry Reedy tjre...@udel.edu

 On 11/4/2013 12:28 AM, memilanuk wrote:

 On 11/03/2013 06:06 PM, yungwong@gmail.com wrote:

 Hi, who has some problems to practice using Python?
 Thx a lot!


 http://projecteuler.net/ is always a good bet


 Also www.checkio.org


 --
 Terry Jan Reedy

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

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


ValueError: zero length field name in format - Running under Python 2.7.3?

2013-11-04 Thread Victor Hooi
Hi,

I have a Python script that's using a format string without positional 
specifiers. I.e.:

LOG_FILENAME = 
'my_something_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S'))

I'm running this from within a virtualenv, running under Python 2.7.3.

$ python -V
Python 2.7.3
$ which python
/opt/my_project_venv/bin/python

The first line of the script is:

#!/usr/bin/env python

However, when I run this line, I get the following error:

Traceback (most recent call last):
  File my_script.py, line 25, in module
LOG_FILENAME = 
'my_something_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S'))
ValueError: zero length field name in format


The weird thing, when I start a Python REPL and run that line interactively, it 
works fine:

$ python
Python 2.7.3 (default, Jan  7 2013, 11:52:52)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)] on linux2
Type help, copyright, credits or license for more information.
 from datetime import datetime
 LOG_FILENAME = 
'my_project_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S'))
 print(LOG_FILENAME)
my_project_2013-05-11_09.29.47.log

My understanding was that in Python 2.7/3.1, you could omit the positional 
specifiers in a format string.



Cheers,
Victor
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread jonas . thornvall
Den måndagen den 4:e november 2013 kl. 15:27:19 UTC+1 skrev Dave Angel:
 On Mon, 4 Nov 2013 05:53:28 -0800 (PST), jonas.thornv...@gmail.com 
 
 wrote:
 
  Den lördagen den 2:e november 2013 kl. 22:31:09 UTC+1 skrev Tim 
 
 Roberts:
 
   Here's another way to look at it.  If f(x) is smaller than x for 
 
 every x,
 
 
 
 
 
 
 
 
 
   that means there MUST me multiple values of x that produce the 
 
 same f(x).
 
 
 
 
 
 
 
 
 
   Do you see?  If x is three bits and f(x) is two bits, that means 
 
 there are
 
 
 
 
 
 
 
 
 
   8 possible values for x but only 4 values for f(x).  So, given an 
 
 f(x), y=
 
 
 
 
 
 
 
 
 
   cannot tell which value of x it came from.  You have lost 
 
 information.
 
 
 
 
 
 
 
 
 
  Well let me try to explain why it is working and i have implemented 
 
 one.
 
  I only need to refresh my memory it was almost 15 years ago.
 
  This is not the solution but this is why it is working.
 
  65536=256^2=16^4=***4^8***=2^16
 
 
 
 
 
  Yes i am aware that 256 is a single byte 8 bits, but the approach 
 
 is valid =
 
  anyway.
 
 
 
 And e ^ (I * pi) == -1
 
 So what. ?
 

e is an approximation... and your idea is not general for any n.
 
 
 Better file that patent, before the patent office realizes the 
 
 analogy to the perpetual motion machine.
 
 
 
 -- 
 
 DaveA

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


Re: How to add a current string into an already existing list

2013-11-04 Thread Denis McMahon
On Mon, 04 Nov 2013 19:03:58 +0200, Nick the Gr33k wrote:

 Please since this column you mentioned is able to store a Python's list
 datatype could you tell me what needs alternation in:

We've already told you, there is NO mysql datatype that can store a 
python list directly. There are ways of storing lists in mysql, but you 
can't pass a list directly into a mysql update or insert query as a 
single record field (you may be able to pass a list of tuples in for a 
multi row update or insert, but that's a different issue).

You could convert the python list into a storable entity, for example 
imploding a list of strings with some arbitrary separator to create a 
long string, store the long string, then when you read it from the 
database explode it back into a list.

Or you could store each element of the list in a downloads tables along 
with a reference to the associated record in the users table.

These are two possible methods of storing a list that is associated with 
a user entry. Which method you use is up to you. There may be others. 
Pick a method and code it.

There is no built in support in the python / mysql system for putting a 
list straight into a database, because mysql does not have a collection 
record type.

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


Re: ValueError: zero length field name in format - Running under Python 2.7.3?

2013-11-04 Thread Chris Angelico
On Tue, Nov 5, 2013 at 9:33 AM, Victor Hooi victorh...@gmail.com wrote:
 However, when I run this line, I get the following error:

 Traceback (most recent call last):
   File my_script.py, line 25, in module
 LOG_FILENAME = 
 'my_something_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S'))
 ValueError: zero length field name in format


 The weird thing, when I start a Python REPL and run that line interactively, 
 it works fine

Google tells me that that was an issue in Python 2.6, so my first
check would be to see what `/usr/bin/env python` actually gives you -
are you running inside an environment that changes your path? Drop a
import sys; print(sys.version) at the top of your script and see
what it's really running as.

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


Re: zero argument member functions versus properties

2013-11-04 Thread Peter Cacioppi
Ian said :

Since the compiler generally can't predict what the types of objects will be, 
the bytecode that it generates can't depend on those types. 

very nice, the py is strong with you. Thanks, Pete



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


Re: ValueError: zero length field name in format - Running under Python 2.7.3?

2013-11-04 Thread Victor Hooi
Hi,

You're right - it was sudo playing up with the virtualenv.

The script was in /opt, so I was testing with sudo to get it to run.

I should have setup a service account, and tested it with that =).

$ python sync_bexdb.py
2.7.3 (default, Jan  7 2013, 11:52:52)
[GCC 4.4.6 20120305 (Red Hat 4.4.6-4)]

$ sudo python sync_bexdb.py
[sudo] password for victor:
2.6.6 (r266:84292, Jul 10 2013, 22:48:45)
[GCC 4.4.7 20120313 (Red Hat 4.4.7-3)]

Cheers,
Victor

On Tuesday, 5 November 2013 10:02:50 UTC+11, Chris Angelico  wrote:
 On Tue, Nov 5, 2013 at 9:33 AM, Victor Hooi victorh...@gmail.com wrote:
 
  However, when I run this line, I get the following error:
 
 
 
  Traceback (most recent call last):
 
File my_script.py, line 25, in module
 
  LOG_FILENAME = 
  'my_something_{}.log'.format(datetime.now().strftime('%Y-%d-%m_%H.%M.%S'))
 
  ValueError: zero length field name in format
 
 
 
 
 
  The weird thing, when I start a Python REPL and run that line 
  interactively, it works fine
 
 
 
 Google tells me that that was an issue in Python 2.6, so my first
 
 check would be to see what `/usr/bin/env python` actually gives you -
 
 are you running inside an environment that changes your path? Drop a
 
 import sys; print(sys.version) at the top of your script and see
 
 what it's really running as.
 
 
 
 ChrisA
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python Practice Problems

2013-11-04 Thread alex23

On 4/11/2013 12:06 PM, yungwong@gmail.com wrote:

Hi, who has some problems to practice using Python?


Try http://projecteuler.net/

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


Re: Compiling Python3 for BeagleBone Black (Angstrom distro)

2013-11-04 Thread Travis Griggs

On Nov 4, 2013, at 9:22 AM, Travis Griggs travisgri...@gmail.com wrote:

 I'm playing with a BeagleBone Black running the angstrom distro. Of course, 
 stock python is 2.7, I'd rather use python3. There isn't a python3 package 
 available for angstrom. So I downloaded the source and compiled. It seemed to 
 work pretty well. I used the basic approach outlined in the REAMDE:
 
 ./configure
 make
 make test
 make install
 
 Now, I want to repeat the process, but be a little more judicious about what 
 all is compiled. For example, I don't really need tk stuff (in fact, it just 
 kept telling me it wasn't there). And there's probably a number of other 
 modules/libraries in the kitchen sink known as the stock install, that I 
 could forgo on a tiny little computer like this.
 
 I see, looking at ./configure --help | less, that I could provide 
 --disable-FEATURE and --without-PACKAGE directives to my ./configure 
 invocation. But what I don't see is how to generate a list of what 
 FEATURES/PACKAGES I could put there for consideration of omission. Is there 
 some magic juju that generates that?
 

Should I have asked this question on python-dev instead? Not currently 
subscribed there… but would if that would generate more informed responses.

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


Compiling Python 3.3.2 on CentOS 6.4 - unable to find compiled OpenSSL?

2013-11-04 Thread Victor Hooi
Hi,

We have a machine running CentOS 6.4, and we're attempting to compile Python 
3.3.2 on it:

# cat /etc/redhat-release
CentOS release 6.4 (Final)

We've compiled openssl 1.0.1e 11 by hand on this box, and installed it into 
/usr/local/:

# openssl
OpenSSL version
OpenSSL 1.0.1e 11 Feb 2013
 
# ls /usr/local/include/openssl/
aes.h   blowfish.h  cmac.h  crypto.h   dso.h ec.h  
hmac.h  md4.h  obj_mac.h  pem2.hrand.hsafestack.h  ssl23.h  
symhacks.h   ui.h
asn1.h  bn.hcms.h   des.h  dtls1.h   engine.h  
idea.h  md5.h  ocsp.h pem.h rc2.h seed.h   ssl2.h   
tls1.h   whrlpool.h
asn1_mac.h  buffer.hcomp.h  des_old.h  ebcdic.h  e_os2.h   
krb5_asn.h  mdc2.h opensslconf.h  pkcs12.h  rc4.h sha.hssl3.h   
ts.h x509.h
asn1t.h camellia.h  conf_api.h  dh.h   ecdh.herr.h 
kssl.h  modes.hopensslv.h pkcs7.h   ripemd.h  srp.hssl.h
txt_db.h x509v3.h
bio.h   cast.h  conf.h  dsa.h  ecdsa.h   evp.h 
lhash.h objects.h  ossl_typ.h pqueue.h  rsa.h srtp.h   stack.h  
ui_compat.h  x509_vfy.h

However, when we try to build Python 3.3.2, it can't seem to find the SSL 
installation:

# make
---
Modules/Setup.dist is newer than Modules/Setup;
check to make sure you have all the updates you
need in your Modules/Setup file.
Usually, copying Modules/Setup.dist to Modules/Setup will work.
---
running build
running build_ext
INFO: Can't locate Tcl/Tk libs and/or headers
building '_ssl' extension
gcc -pthread -fPIC -DNDEBUG -g -fwrapv -O3 -Wall -Wstrict-prototypes 
-I./Include -I. -IInclude -I/usr/local/include -I/root/Python-3.3.2/Include 
-I/root/Python-3.3.2 -c /root/Python-3.3.2/Modules/_ssl.c -o 
build/temp.linux-x86_64-3.3/root/Python-3.3.2/Modules/_ssl.o
gcc -pthread -shared 
build/temp.linux-x86_64-3.3/root/Python-3.3.2/Modules/_ssl.o -L/usr/local/lib 
-lssl -lcrypto -o build/lib.linux-x86_64-3.3/_ssl.cpython-33m.so
*** WARNING: renaming _ssl since importing it failed: 
build/lib.linux-x86_64-3.3/_ssl.cpython-33m.so: undefined symbol: 
EC_KEY_new_by_curve_name
 
Python build finished, but the necessary bits to build these modules 
were not found:
_dbm   _gdbm  _lzma  
_tkinter  
To find the necessary bits, look in setup.py in detect_modules() for 
the module's name.
 
 
Failed to build these modules:
_ssl 
 
running build_scripts
copying and adjusting /root/Python-3.3.2/Tools/scripts/pydoc3 - 
build/scripts-3.3
copying and adjusting /root/Python-3.3.2/Tools/scripts/idle3 - 
build/scripts-3.3
copying and adjusting /root/Python-3.3.2/Tools/scripts/2to3 - 
build/scripts-3.3
copying and adjusting /root/Python-3.3.2/Tools/scripts/pyvenv - 
build/scripts-3.3
changing mode of build/scripts-3.3/pydoc3 from 644 to 755
changing mode of build/scripts-3.3/idle3 from 644 to 755
changing mode of build/scripts-3.3/2to3 from 644 to 755
changing mode of build/scripts-3.3/pyvenv from 644 to 755
renaming build/scripts-3.3/pydoc3 to build/scripts-3.3/pydoc3.3
renaming build/scripts-3.3/idle3 to build/scripts-3.3/idle3.3
renaming build/scripts-3.3/2to3 to build/scripts-3.3/2to3-3.3
renaming build/scripts-3.3/pyvenv to build/scripts-3.3/pyvenv-3.3

I also tried editing the Modules/Setup.dist file, no luck there either.

Any thoughts on what we're doing wrong?

Cheers,
Victor
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: Compiling Python 3.3.2 on CentOS 6.4 - unable to find compiled OpenSSL?

2013-11-04 Thread Joseph L. Casale
 Any thoughts on what we're doing wrong?

Building them yourself:)

Try iuscommunity.org for prebuilt packages...
-- 
https://mail.python.org/mailman/listinfo/python-list


Trouble with utf-8 values

2013-11-04 Thread Ulrich Goebel

Hallo,

again: a python beginner problem... but I spent ours to solve it without 
success.


I have an object (a variable) name, which gets its value from a 
PostgreSQL database via a SELECT statement, an it sometimes has german 
special characters as ß, ä, ö...


Then I would like to insert that value into a table in a SQLite 
database. So I make a cursor cur on the table and prepare a SQL 
statement like this:


sql = 'insert into tbl values(?)'
cur.execute(sql, (name,))

That ends up with the exception, for example,

UnicodeDecodeError: 'ascii' codec can't decode byte 0xc3 in position 6: 
ordinal not in range(128)


The position 6 is exactly the position of the special character, ß in 
this case.


What to do?

Ulrich


--
Ulrich Goebel
Paracelsusstr. 120, 53177 Bonn
--
https://mail.python.org/mailman/listinfo/python-list


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Dave Angel
On Mon, 4 Nov 2013 14:34:23 -0800 (PST), jonas.thornv...@gmail.com 
wrote:

e is an approximation... and your idea is not general for any n.


e is certainly not an approximation,  and I never mentioned n.

--
DaveA

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


Re: Trouble with utf-8 values

2013-11-04 Thread Ben Finney
Ulrich Goebel m...@fam-goebel.de writes:

 I have an object (a variable) name

This confuses me. Is it an object, a variable, or a name?

 which gets its value from a PostgreSQL database via a SELECT
 statement, an it sometimes has german special characters as ß, ä, ö...

What is the type of that object? You can interrogate Python for the
answer, by using ‘type(foo)’ which will return the type of the object
named by “foo”.

 Then I would like to insert that value into a table in a SQLite
 database. So I make a cursor cur on the table and prepare a SQL
 statement like this:

 sql = 'insert into tbl values(?)'
 cur.execute(sql, (name,))

What version of Python are you running?

Do you get different results in Python 2 versus Python 3? One of the
biggest improvements in Python 3 is the proper handling of Unicode, with
more explicit rejection of ambiguity between bytes versus text.

-- 
 \  “The face of a child can say it all, especially the mouth part |
  `\of the face.” —Jack Handey |
_o__)  |
Ben Finney

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


Re: Compiling Python3 for BeagleBone Black (Angstrom distro)

2013-11-04 Thread Terry Reedy

On 11/4/2013 7:23 PM, Travis Griggs wrote:


On Nov 4, 2013, at 9:22 AM, Travis Griggs travisgri...@gmail.com wrote:


I'm playing with a BeagleBone Black running the angstrom distro. Of course, 
stock python is 2.7, I'd rather use python3. There isn't a python3 package 
available for angstrom. So I downloaded the source and compiled. It seemed to 
work pretty well. I used the basic approach outlined in the REAMDE:

./configure
make
make test
make install

Now, I want to repeat the process, but be a little more judicious about what 
all is compiled. For example, I don't really need tk stuff (in fact, it just 
kept telling me it wasn't there). And there's probably a number of other 
modules/libraries in the kitchen sink known as the stock install, that I could 
forgo on a tiny little computer like this.

I see, looking at ./configure --help | less, that I could provide 
--disable-FEATURE and --without-PACKAGE directives to my ./configure 
invocation. But what I don't see is how to generate a list of what 
FEATURES/PACKAGES I could put there for consideration of omission. Is there 
some magic juju that generates that?



Should I have asked this question on python-dev instead? Not currently 
subscribed there… but would if that would generate more informed responses.


pydev is for concrete discussion of developing future CPython releases.
Questions about using current releases belong here. If you cannot get an 
answer after a week, because no one knows or can get the answer, then 
there might be a case for improving something.


--
Terry Jan Reedy


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


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Steven D'Aprano
On Mon, 04 Nov 2013 14:34:23 -0800, jonas.thornvall wrote:

 Den måndagen den 4:e november 2013 kl. 15:27:19 UTC+1 skrev Dave Angel:
 On Mon, 4 Nov 2013 05:53:28 -0800 (PST), jonas.thornv...@gmail.com
 wrote:
[...]
  This is not the solution but this is why it is working.
 
  65536=256^2=16^4=***4^8***=2^16

this being Jonas' alleged lossless compression method capable of 
compressing random data.


  Yes i am aware that 256 is a single byte 8 bits, but the approach
 is valid anyway.

I must say, I cannot see the connection between the fact that 256**2 == 
2**16 and compression of random data. I might as well state that I have 
squared the circle, and offer as proof that 3+4 == 5+2.



 And e ^ (I * pi) == -1
 
 So what. ?
 
 
 e is an approximation... and your idea is not general for any n.

e is not an approximation, it is a symbolic name for an exact  
transcendental number which cannot be specified exactly by any finite 
number of decimal places.

Your comment about n is irrelevant, since Euler's Identity e**(i*pi)=-1 
has nothing to do with n. But in case you actually meant i, again you 
are mistaken. i is a symbolic name for an exact number.



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


Re: Algorithm that makes maximum compression of completly diffused data.

2013-11-04 Thread Steven D'Aprano
On Tue, 05 Nov 2013 04:33:46 +, Steven D'Aprano wrote:

 On Mon, 04 Nov 2013 14:34:23 -0800, jonas.thornvall wrote:
 
 Den måndagen den 4:e november 2013 kl. 15:27:19 UTC+1 skrev Dave Angel:
 On Mon, 4 Nov 2013 05:53:28 -0800 (PST), jonas.thornv...@gmail.com
 wrote:
 [...]
  This is not the solution but this is why it is working.
 
  65536=256^2=16^4=***4^8***=2^16
 
 this being Jonas' alleged lossless compression method capable of
 compressing random data.

/facepalm

I meant it, not this, as in why it (the compression method) is 
working. Sorry for any confusion.



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


Re: Basic Python Questions - Oct. 31, 2013

2013-11-04 Thread E.D.G.
Jim Gibson jimsgib...@gmail.com wrote in message 
news:031120131018099327%jimsgib...@gmail.com...



One way to generate plot within a CGI program is this:


  To start off with, I am not a CGI expert.  Also, I have several 
degrees in the physical sciences and many years of doing computer 
programming.  But the programming work is done just to get various science 
projects to work.


  The question that I could not get an answer for was, “How can you get 
Gnuplot to run on an Internet server computer?”


  And I would eventually have to ask that same question for Python.

  My Internet Server looks like it has Perl, Perl5, and PHP available. 
And I have created a number of CGI Perl programs that run on the Web site. 
But as I said, I would not know how to get Gnuplot or Python to run at the 
site.


  Any recommendations for how to do that?  Or should I just do a search 
for the necessary documentation?


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


Re: How to add a current string into an already existing list

2013-11-04 Thread Nick the Gr33k

Στις 5/11/2013 12:46 πμ, ο/η Denis McMahon έγραψε:

On Mon, 04 Nov 2013 19:03:58 +0200, Nick the Gr33k wrote:



There is no built in support in the python / mysql system for puttinga
list straight into a database, because mysql does not havecollection
record type.


Does postgresql has this 'collection' record type



You could convert the python list into a storable entity, for example
imploding a list of strings with some arbitrary separator to create a
long string, store the long string, then when you read it from the
database explode it back into a list.
Which method you use is up to you. There may be others.
Pick a method and code it.


Okey here is my attempt to code your solution as best as i can get my 
head around it:


This is the part that is responsible to do the database insertion 
converting scalars to lists and backwards.


=
try:
		# if first time for webpage; create new record( primary key is 
automatic, hit is defaulted ), if page exists then update record
		cur.execute('''INSERT INTO counters (url) VALUES (%s) ON DUPLICATE KEY 
UPDATE hits = hits + 1''', page )

cID = cur.lastrowid

# fetch those columns that act as lists but are stored as 
strings
		cur.execute('''SELECT refs, visits, downloads FROM visitors WHERE 
counterID = %s''', cID )

data = cur.fetchone

ref = data[0]
visit = data[1]
download = data[2]

# retrieve long strings and convert them into lists respectively
refs = ref.split()
visits = visit.split()
downloads = download.split()

# add current strings to the each list respectively
refs.appends( ref )
visits.appends( visit )
downloads.appends( download )

# convert lists back to longstrings
refs = ', '.join( refs )
visits = ', '.join( visits )
downloads = ', '.join( downloads )

# add this visitor entry into database (hits  downloads are 
defaulted)
		cur.execute('''INSERT INTO visitors (counterID, refs, host, city, 
useros, browser, visits, hits = hits + 1, downloads) VALUES (%s, %s, %s, 
%s, %s, %s, %s, %s, %s)''',

(cID, refs, host, city, useros, 
browser, visits, hits, downloads) )

con.commit()
except pymysql.ProgrammingError as e:
print( repr(e) )
con.rollback()
sys.exit(0)
===

Please tell me if this logic is correct, for some reason it doesn't do 
what i need it to do.


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


[issue19488] idlelib tests are silently skipped by test.regrtest on 2.7

2013-11-04 Thread Terry J. Reedy

Terry J. Reedy added the comment:

As I explained on the checkins list, I am do hg import --no-commit indirectly 
though TortoiseHg Workbench Repository/import. It normally brings up an edit 
box for a commit message after patching and if that is left blank, it does not 
commit. With a message in the patch (non-comment text above 'diff'), it skips 
the edit box and just commits. I just verified this behavior difference with 
your patch on a local repository with test_idle.py. I first imported without 
the message, left the edit box blank, reverted, and then imported with a 
message added back.

Since the patch says it is a changeset patch, I assume you committed it in and 
transferred it from a separate repository.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19488
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19422] Neither DTLS nor error for SSLSocket.sendto() of UDP socket

2013-11-04 Thread Vajrasky Kok

Vajrasky Kok added the comment:

Attached the patch to raise error when using sock dgram in wrap_socket.

I am still unsure whether I should put the validation in C code (private 
function _wrap_socket) or not.

--
keywords: +patch
nosy: +vajrasky
Added file: 
http://bugs.python.org/file32489/raises_error_on_wrap_socket_with_sock_dgram.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19422
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I suppose this is related to pickling.

I were puzzled why it works with bytearray subclasses. But now I investigated 
that print() implicitly converts str and bytearray subclasses to str and left 
unicode subclasses as is. You can reproduce this bug for str and bytearray 
subclasses if use sys.stdout.write() instead of print().

Here is a patch for 2.7 which fixes the issue for str and bytearray subclasses 
too. 3.x needs patch too.

 class U(unicode): pass

 class S(str): pass

 class BA(bytearray): pass

 import sys
 sys.stdout.write(u'\u20ac')
€
 sys.stdout.write('\xe2\x82\xac')
€
 sys.stdout.write(bytearray('\xe2\x82\xac'))
€
 sys.stdout.write(U(u'\u20ac'))
€
 sys.stdout.write(S('\xe2\x82\xac'))
€
 sys.stdout.write(BA('\xe2\x82\xac'))
€

--
versions: +Python 3.3, Python 3.4
Added file: 
http://bugs.python.org/file32490/idle_write_string_subclass-2.7.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19490] Problem installing matplotlib 1.3.1 with Python 2.7.6rc1 and 3.3.3rc1

2013-11-04 Thread Ned Deily

New submission from Ned Deily:

Piet van Oostrum (on python-dev and elsewhere) wrote:

I tried to install matplotlib 1.3.1 on the release candidates of Python 2.7.6 
and 3.3.3.
I am on Mac OS X 10.6.8.
Although the installation gave no problems, there is a problem with Tcl/Tk.

The new Pythons have their own embedded Tcl/Tk, but when installing matplotlib 
it links to the Frameworks version of Tcl and TK, not to the embedded version. 
This causes confusion when importing matplotlib.pyplot:

objc[70648]: Class TKApplication is implemented in both 
/Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. 
Which one is undefined.
objc[70648]: Class TKMenu is implemented in both 
/Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. 
Which one is undefined.
objc[70648]: Class TKContentView is implemented in both 
/Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. 
Which one is undefined.
objc[70648]: Class TKWindow is implemented in both 
/Library/Frameworks/Python.framework/Versions/2.7/lib/libtk8.5.dylib and 
/Library/Frameworks/Tk.framework/Versions/8.5/Tk. One of the two will be used. 
Which one is undefined.

And then later it gives a lot of error messages.

So I think it should be linked to the embedded version. For this the matplotlib 
setupext.py should be adapted to find out if there is an embedded Tcl/Tk in the 
Python installation and set the link parameters accordingly. However, the 
installed Python versions (from the DMG's) do not contain the Tcl/Tk header 
files, only the shared library and the tcl files. So I thing the distributed 
Python should also include the Tcl/Tk header files.

https://mail.python.org/pipermail/python-dev/2013-November/129993.html

--
assignee: ned.deily
components: Installation, Macintosh
messages: 202097
nosy: benjamin.peterson, georg.brandl, larry, ned.deily, pietvo
priority: release blocker
severity: normal
status: open
title: Problem installing matplotlib 1.3.1 with Python 2.7.6rc1 and 3.3.3rc1
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19490
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

And here is a patch for 3.x. Without it following code hangs.

 class S(str): pass

 import sys
 sys.stdout.write('\u20ac')
€1
 sys.stdout.write(S('\u20ac'))
€1

--
Added file: 
http://bugs.python.org/file32491/idle_write_string_subclass-3.x.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17827] Document codecs.encode and codecs.decode

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Hmm, I just noticed an interesting issue here in drafting the 2.7 backport: as 
near as I can tell, these aren't tested, so other implementations that failed 
to provide them would pass the 2.7 and 3.3 test suites.

--
Added file: http://bugs.python.org/file32492/issue17827_docs_py27.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17827
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17827] Document and test codecs.encode and codecs.decode

2013-11-04 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
title: Document codecs.encode and codecs.decode - Document and test 
codecs.encode and codecs.decode
versions: +Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17827
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19490] Problem installing matplotlib 1.3.1 with Python 2.7.6rc1 and 3.3.3rc1

2013-11-04 Thread Ned Deily

Ned Deily added the comment:

That's unfortunate.  It looks like matplotlib on OS X (darwin) has cpp code 
that interfaces directly with Tk and, hence, needs Tk headers.  Further, for OS 
X (darwin), its setup.py assumes that Tkinter is linked with Tcl and Tk 
installed as frameworks in /Library/Frameworks (for third-party installs) or 
/System/Library/Frameworks (the Apple-supplied ones).  It also appears that 
matplotlib borrowed these assumptions from PIL (the Python Imaging Library 
project) and which have been carried into its fork, Pillow.

The current implementation of the built-in Tcl/Tk for the python OS X 
installers was designed to be standalone for Tkinter's use only.  So it 
currently does not install Tcl and Tk header files.  It also does not install 
Tcl and Tk into /Library/Frameworks so that it will not conflict with existing 
installations, like from ActiveState, that might have additional packages 
installed for real Tcl/Tk applications.  As Piet noted for matplotlib, just 
including header files would not by itself solve the problem for these 
projects.  Their setup*.py files would need to change as well to understand the 
new locations. (Sidenote: I see that at least one of the third-party OS X 
packagers, MacPorts, has a similar problem and patches these files in order for 
their ports of these projects to use the MacPorts-installed Tcl and Tk.)

In anticipation of some problems like this, the rc1 installers ship with two 
versions of _tkinter.so: one linked with the new built-in Tcl/Tk libs and the 
other linked as before with Tcl and Tk frameworks in /Library/Frameworks 
falling back to /System/Library/Frameworks.  The latter _tkinter.so is not on 
the default search path.  It is possible for the user administrator to change 
the installation to always use the old-style _tkinter.so by copying it into 
lib-dynload.  This is documented, although rather obscurely, in the installer 
BuildScript README.  It is also possible to dynamically override at execution 
time by manipulating the Python search path, either by setting PYTHONPATH or 
prepending to sys.path the path to the directory with old-style _tkinter.so.  
This is even more obscurely documented.  The hope was that neither would be 
routinely needed except by expert users for some corner cases.  But matplotlib 
and PIL/Pillow do not fit that category.

There are various options. I want to ponder them for a bit; I'll have an update 
within 24 hours.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19490
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17827] Document codecs.encode and codecs.decode

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Oops, never mind - the tests are already there (and have been since MAL's 
original commit prior to Python 2.4), I just fail at searching code.

--
title: Document and test codecs.encode and codecs.decode - Document 
codecs.encode and codecs.decode
versions:  -Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17827
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19481] IDLE hangs while printing instance of Unicode subclass

2013-11-04 Thread Ned Deily

Ned Deily added the comment:

Pickling for the RPC protocol between the GUI process and the interpreter 
subprocess, which would explain why there is no problem when running idle -n 
(no subproces)?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19481
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread Carolyn Reed

New submission from Carolyn Reed:

The ICT teacher at the school I work at has reported that frequently students 
are experiencing their Python software crashing when they attempt to save 
files.  No error message is reported, the software just freezes.

They are using the IDLE GUI Python v 3.2.4 on Windows 7 Professional 32-bit.

Please advise.

--
components: IDLE
messages: 202103
nosy: carolyn.r...@talktalk.net
priority: normal
severity: normal
status: open
title: Python Crashing When Saving Documents
type: crash
versions: Python 3.2

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

Could you try to collect more information, like an error message, or better a 
traceback?

Do you get a Windows popup like program crashed?

Try to run IDLE from the command line, not from the icon, to get the traceback.

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

By the way, Python 3.2.4 is old, you should try to reproduce your issue with 
a newer Python version, like Python 3.3.2.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread Carolyn Reed

Carolyn Reed added the comment:

Unfortunately we are unable to run it from the command line - as we are a 
school this is locked down for students. 

There are no error messages at all, the program just freezes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread Carolyn Reed

Carolyn Reed added the comment:

Okay, we'll see if we can go to V 3.3.2  and see what difference this makes.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17827] Document codecs.encode and codecs.decode

2013-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset bdb30bdf60a5 by Nick Coghlan in branch '2.7':
Close #17827: Document codecs.encode  codecs.decode
http://hg.python.org/cpython/rev/bdb30bdf60a5

--
resolution:  - fixed
stage: needs patch - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17827
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

2013-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 536a7c09c7fd by Victor Stinner in branch 'default':
Issue #16286: write a new subfunction bytes_compare_eq()
http://hg.python.org/cpython/rev/536a7c09c7fd

--
nosy: +python-dev

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19491] Python Crashing When Saving Documents

2013-11-04 Thread Carolyn Reed

Carolyn Reed added the comment:

There doesn't seem to be a Pygame version for 3.3 on the pygame webpage?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19491
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

2013-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 5fa291435740 by Victor Stinner in branch 'default':
Issue #16286: optimize PyUnicode_RichCompare() for identical strings (same
http://hg.python.org/cpython/rev/5fa291435740

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18702] Report skipped tests as skipped

2013-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

I forgot to merge branches? Thanks Ned.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18702
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19424] _warnings: patch to avoid conversions from/to UTF-8

2013-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 494f736f5945 by Victor Stinner in branch 'default':
Issue #19424: PyUnicode_CompareWithASCIIString() normalizes memcmp() result
http://hg.python.org/cpython/rev/494f736f5945

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19424
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

2013-11-04 Thread Roundup Robot

Roundup Robot added the comment:

New changeset da9c6e4ef301 by Victor Stinner in branch 'default':
Issue #16286: remove duplicated identity check from unicode_compare()
http://hg.python.org/cpython/rev/da9c6e4ef301

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

I applied changes unrelated to the hash.

--
Added file: http://bugs.python.org/file32493/compare_hash-3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19466] Clear state of threads earlier in Python shutdown

2013-11-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


--
nosy: +serhiy.storchaka

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19466
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue16286] Use hash if available to optimize a==b and a!=b for bytes and str

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

Results of benchmarks using compare_hash-3.patch:

$ time ../benchmarks/perf.py -r -b default ./pythonorig ./pythonhash 
INFO:root:Skipping benchmark slowspitfire; not compatible with Python 3.4
INFO:root:Skipping benchmark slowpickle; not compatible with Python 3.4
INFO:root:Skipping benchmark slowunpickle; not compatible with Python 3.4
INFO:root:Skipping benchmark spambayes; not compatible with Python 3.4
Running 2to3...
Running django_v2...

Report on Linux smithers 3.9.4-200.fc18.x86_64 #1 SMP Fri May 24 20:10:49 UTC 
2013 x86_64 x86_64
Total CPU cores: 8

### 2to3 ###
Min: 6.358000 - 6.055000: 1.05x faster
Avg: 6.407600 - 6.179800: 1.04x faster
Significant (t=3.53)
Stddev: 0.04311 - 0.13785: 3.1979x larger

### nbody ###
Min: 0.219029 - 0.212477: 1.03x faster
Avg: 0.224940 - 0.219248: 1.03x faster
Significant (t=10.13)
Stddev: 0.00373 - 0.00420: 1.1288x larger

The following not significant results are hidden, use -v to show them:
django_v2.


At least, Python is not slower with the patch :-) I'm surprised that the 
benchmark shows a difference. nbody benchmark is focused on float numbers. I 
checked with gdb, nbody benchmark does not call any Unicode comparison function.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue16286
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7442] _localemodule.c: str2uni() with different LC_NUMERIC and LC_CTYPE

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

@Stefan: Did you my comments on Rietveld?
http://bugs.python.org/review/7442/#ps1473

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7442
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18931] new selectors module should support devpoll on Solaris

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

@Giampaolo: Your patch doesn't apply cleanly anymore. Could you update it?

Issue #19172 has been fixed, selectors now have a get_map() method.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18931
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19480] HTMLParser fails to handle some characters in the starttag

2013-11-04 Thread Ezio Melotti

Ezio Melotti added the comment:

For 2.7 that sounds like a reasonable option, for 3.3/3.4 however I'm keeping 
the name but I change the regex groups, so it might break if someone is using 
it with groups.  In theory I could add a third name and leave that unchanged, 
but I'm not sure it's worth it.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19480
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19251] bitwise ops for bytes of equal length

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

You got me, Antoine! I'm working on a Python-only implementation of 
PBKDF2_HMAC. It involves XOR of two bytes in one place.

If you want super-fast code, you should probably reimplement it in C. Python is 
not designed for performances...

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19251
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Added file: http://bugs.python.org/file32494/022955935ba3.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18874
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file32478/65e72bf01246.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18874
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18874] Add a new tracemalloc module to trace memory allocations

2013-11-04 Thread STINNER Victor

Changes by STINNER Victor victor.stin...@gmail.com:


Removed file: http://bugs.python.org/file32211/57ae01bf96cb.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18874
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19480] HTMLParser fails to handle some characters in the starttag

2013-11-04 Thread R. David Murray

R. David Murray added the comment:

Then for 3.3 you are bug fixing the regex, so anyone using it ought to want the 
change, right? :)

If the same is true for 2.7, then creating an alias would probably be fine.  I 
haven't looked at the details, so I'll leave it to your judgment.  I just don't 
want the name going away in 2.7, it might be a gratuitous breaking of someone's 
code.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19480
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19017] selectors: towards uniform EBADF handling

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

What is the status of this issue?

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19017
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19492] Report skipped distutils tests as skipped

2013-11-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Some skipped distutils tests are reported as passed. Arfrever pointed out on 
some of these tests on IRC. Proposed patch adds explicit reporting them as 
skipped.

See also issue18702.

--
assignee: eric.araujo
components: Distutils, Tests
messages: 202123
nosy: eric.araujo, serhiy.storchaka, tarek
priority: normal
severity: normal
stage: patch review
status: open
title: Report skipped distutils tests as skipped
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19492
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19493] Report skipped ctypes tests as skipped

2013-11-04 Thread Serhiy Storchaka

New submission from Serhiy Storchaka:

Some skipped ctypes tests are reported as passed. Proposed patch adds explicit 
reporting them as skipped.

See also issue18702.

--
components: Tests, ctypes
files: skip_tests_ctypes.patch
keywords: patch
messages: 202124
nosy: amaury.forgeotdarc, belopolsky, meador.inge, serhiy.storchaka
priority: normal
severity: normal
stage: patch review
status: open
title: Report skipped ctypes tests as skipped
type: enhancement
versions: Python 2.7, Python 3.3, Python 3.4
Added file: http://bugs.python.org/file32495/skip_tests_ctypes.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19493
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17828] More informative error handling when encoding and decoding

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Updated patch. The results of this suggests to me that the input wrappers are 
likely infeasible at this point in time, but improving the errors for the wrong 
*output* type is entirely feasible. Since the main conversion we need to prompt 
is things like binary_object.decode(binary_codec) - 
codecs.decode(binary_object, binary_codec), I suggest we limit the scope of 
this issue to that part of the problem.

 import codecs
 codecs.encode(bhello, bz2_codec).decode(bz2_codec)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'bz2_codec' decoder returned 'bytes' instead of 'str'; use 
codecs.decode to decode to arbitrary types
 hello.encode(bz2_codec)
TypeError: 'str' does not support the buffer interface

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid input type for 'bz2_codec' codec (TypeError: 'str' does not 
support the buffer interface)
 hello.encode(rot_13)
TypeError: 'rot_13' encoder returned 'str' instead of 'bytes'; use 
codecs.encode to encode to arbitrary types

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid input type for 'rot_13' codec (TypeError: 'rot_13' encoder 
returned 'str' instead of 'bytes'; use codecs.encode to encode to arbitrary 
types)

--
Added file: 
http://bugs.python.org/file32496/issue17828_improved_codec_errors.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17828
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue18702] Report skipped tests as skipped

2013-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Related issues: issue19492 and issue19493.

--
resolution:  - fixed
stage: patch review - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue18702
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7442] _localemodule.c: str2uni() with different LC_NUMERIC and LC_CTYPE

2013-11-04 Thread Stefan Krah

Stefan Krah added the comment:

Yes, I saw the comments. I'm still wondering if we should just write an
mbstowcs_l() function instead.

Even then, there would still be a small chance that a C extension that
creates its own thread picks up the wrong LC_CTYPE.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7442
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19492] Report skipped distutils tests as skipped

2013-11-04 Thread Vajrasky Kok

Vajrasky Kok added the comment:

You forgot to upload the proposed patch, Serhiy.

--
nosy: +vajrasky

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19492
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17828] More informative error handling when encoding and decoding

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Ah, came up with a relatively simple solution based on an internal helper 
function with an optional output flag:

 import codecs
 codecs.encode(bhello, bz2_codec).decode(bz2_codec)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'bz2_codec' decoder returned 'bytes' instead of 'str'; use 
codecs.decode to decode to arbitrary types

 hello.encode(bz2_codec)
TypeError: 'str' does not support the buffer interface

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid input type for 'bz2_codec' codec (TypeError: 'str' does not 
support the buffer interface)

 hello.encode(rot_13)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'rot_13' encoder returned 'str' instead of 'bytes'; use 
codecs.encode to encode to arbitrary types

--
Added file: 
http://bugs.python.org/file32497/issue17828_improved_codec_errors_v2.diff

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17828
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7475] codecs missing: base64 bz2 hex zlib hex_codec ...

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

For anyone interested, I have a patch up on issue 17828 that produces the 
following output for various codec usage errors:

 import codecs
 codecs.encode(bhello, bz2_codec).decode(bz2_codec)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'bz2_codec' decoder returned 'bytes' instead of 'str'; use 
codecs.decode to decode to arbitrary types

 hello.encode(bz2_codec)
TypeError: 'str' does not support the buffer interface

The above exception was the direct cause of the following exception:

Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: invalid input type for 'bz2_codec' codec (TypeError: 'str' does not 
support the buffer interface)

 hello.encode(rot_13)
Traceback (most recent call last):
  File stdin, line 1, in module
TypeError: 'rot_13' encoder returned 'str' instead of 'bytes'; use 
codecs.encode to encode to arbitrary types

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7475
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17828] More informative error handling when encoding and decoding

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

The other thing is that this patch doesn't wrap AttributeError. I'm OK with 
that, since I believe the only codec in the standard library that currently 
throws that for a bad input type is rot_13.

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17828
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue7442] _localemodule.c: str2uni() with different LC_NUMERIC and LC_CTYPE

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

What is this locale_t type used for the locale parameter of mbstowcs_l()? Are 
you sure that it is a string? According to this patch, it looks like a 
structure:
http://www.winehq.org/pipermail/wine-cvs/2010-May/067264.html

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue7442
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue17828] More informative error handling when encoding and decoding

2013-11-04 Thread STINNER Victor

STINNER Victor added the comment:

It would be simpler to just drop these custom codecs (rot13, bz2, hex, etc.) 
instead of helping to use them :-)

--
nosy: +haypo

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue17828
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19487] Correct the error of the example given in the doc of partialmethod

2013-11-04 Thread Nick Coghlan

New submission from Nick Coghlan:

Thanks for the report, this has now been fixed in 
http://hg.python.org/cpython/rev/ac1685661b07

--
resolution:  - fixed
stage:  - committed/rejected
status: open - closed

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19487
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19378] Clean up Python 3.4 API additions in the dis module

2013-11-04 Thread Nick Coghlan

Changes by Nick Coghlan ncogh...@gmail.com:


--
assignee:  - ncoghlan

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19378
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue4331] Add functools.partialmethod

2013-11-04 Thread Nick Coghlan

Nick Coghlan added the comment:

Indeed, added to __all__ in http://hg.python.org/cpython/rev/ac1685661b07

--

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue4331
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



[issue19492] Report skipped distutils tests as skipped

2013-11-04 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Thank you Vajrasky.

--
keywords: +patch
Added file: http://bugs.python.org/file32498/skip_tests_distutils.patch

___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue19492
___
___
Python-bugs-list mailing list
Unsubscribe: 
https://mail.python.org/mailman/options/python-bugs-list/archive%40mail-archive.com



  1   2   >