PyConZA 2013 - Talk submission deadline extended

2013-09-03 Thread Neil Muller
PyConZA will take place 3rd  4th October in Cape Town, South Africa.
There will be two days of talks, and we will hold sprints on the 5th 
6th of October.

We have extended the deadline for talk submissions until the 15th of September.

If you would like to give a presentation, please register at
http://za.pycon.org/ and submit your proposal. Accepted presenters
will be notified by no later than the 22nd of September. The
presentation slots will be 30 minutes long, with an additional 10
minutes for discussion at the end. Shared sessions are also possible.
The presentations will be in English.

More details are available at http://za.pycon.org/talks/submit-talk .

-- 
Neil Muller
On behalf of the PyConZA organising committee
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Retask 0.4 released

2013-09-03 Thread Kushal Das
Hi all,

During this weekend in PyCon India I released `Retask 0.4
http://retask.readthedocs.org/en/latest/`_. You can install it from
PyPi.

What is Retask ?
--
Retask is a python module to create and manage distributed task queue/job queue.

It uses Redis to create task queues. User can enqueue and dequeue
tasks in the queues they manage. Each task can contain any JSON
serializable python objects. We use JSON internally to store the tasks
in the queues.

Features added
---

- Python 3 support (Done with help from Toshio during Python 3 porting
OpenSpace in PyCon US 2013)
- Partially specifying a Queue config (Thanks to the patches from Ralph Bean).
- API is much more simplified (Thanks to Kenneth Reitz for the tips).
- Many documentation updates (Thanks to patches from Maximiliano Curia).


On going work
--
We are working on one C library and one for Go. With these one can
enqueue tasks in from a system written in a different language and
execute it in a worker with a different language.

Kushal
-- 
http://fedoraproject.org
http://kushaldas.in
-- 
http://mail.python.org/mailman/listinfo/python-announce-list

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


Re: Cookie or not..?

2013-09-03 Thread dieter
mrcol...@gmail.com writes:

 I am a Python noob, and need some help. I am trying to log in to website 
 using python and parse info after login.

 In a browser, this link will log me in and keep me loged in:
 http://[domain].com/loginh.aspx?SID=[xxx]USER=[xxx]PW=[xxx]

 (sorry for the tripple x, but it is actually not something nasty :-) )

Look at the cookielib (called cookiejar for Python 3) module
in Python's library.

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


Re: How to execute command on remote windows machine

2013-09-03 Thread gaurangnshah
Hi alex 

I tried the command you suggested however it is giving me following error. 

ERROR: The RPC server is unavailable.

On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
 On 3/09/2013 2:45 PM, gaurangns...@gmail.com wrote:
 
  I have a requirement where i need to kill one process on remote windows 
  machine.
 
  Following command just works fine if i have to kill process on local machine
 
 
 
  os.system('taskkill /f /im processName.exe')
 
 
 
  However I am not able to figure out how to execute this command on remote 
  windows machine.
 
 
 
 The simplest way is from your local machine. taskkill accepts a /s 
 
 parameter which can specify a remote machine by IP or name.
 
 
 
 http://technet.microsoft.com/en-us/library/bb491009.aspx



On Tuesday, 3 September 2013 11:03:17 UTC+5:30, alex23  wrote:
 On 3/09/2013 2:45 PM, gaurangns...@gmail.com wrote:
 
  I have a requirement where i need to kill one process on remote windows 
  machine.
 
  Following command just works fine if i have to kill process on local machine
 
 
 
  os.system('taskkill /f /im processName.exe')
 
 
 
  However I am not able to figure out how to execute this command on remote 
  windows machine.
 
 
 
 The simplest way is from your local machine. taskkill accepts a /s 
 
 parameter which can specify a remote machine by IP or name.
 
 
 
 http://technet.microsoft.com/en-us/library/bb491009.aspx
-- 
http://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-03 Thread Antoon Pardon

Op 03-09-13 01:17, Modulok schreef:
 
 So? Indeed there are too many people looking at these things as fighting
 for the one true way. That is IMO part a big part of the problem. I have
 no problem if someone else uses a different style than I do. Python as
 a language tries too hard to enforce a one true way.
  
 Try maintaining a non-trivial body of JavaScript, or Perl (that you didn't
 write) for a while. You'll soon appreciate the One True Way of thinking lol.

My impression is that everyone appreciates the One True Way but only
because they identify their own way as the One True Way. And sure it
can be a good thing to enforce a One True Way for a specific project
or for all company code, but there is no need that all projects would
need the same One True Way.

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


Cannot form correctly the FORM part of the header when sending mail

2013-09-03 Thread Ferrous Cranus

Hello,
i have written the following snipper of code to help me send mail:


=
# if html form is submitted then send user mail
#
if( mailform ):

try:
if (FROM is None) or (MESSAGE is None) or ('@' not in FROM) or 
('Γράψε μου εδώ' in MESSAGE):
print( h2font color=redΣυμπλήρωσε σωστά το mail σου 
και δώσε το σχολιασμό σου!/font/h2 )

else:
# prepare mail data
TO = ni...@superhost.gr

SUBJECT = uMail από τον επισκέπτη: ( %s ) % FROM

MESSAGE = From: %s\r\n + To: %s\r\n + Subject: %s\r\n 
+ MESSAGE + \r\n

MESSAGE = MESSAGE % ( FROM, TO, SUBJECT )
MESSAGE = MESSAGE.encode('utf-8')

# open Gmail's SMTP server
server = smtplib.SMTP('smtp.gmail.com:587')
server.ehlo()
server.starttls()

# next, log in to the server
server.login(nikos.gr...@gmail.com, rmrcdherpbsfggcw)

# send the mail
server.sendmail( FROM, [TO], MESSAGE )

print( h2font color=blueΕυχαριστώ πολύ για το 
ενδιαφέρον! Θα επικοινωνήσω μαζί σου άμεσα :-)/font/h2 )

except Exception as e:
print( repr(e), file=open( '/tmp/err.out', 'a' ) )

sys.exit(0)
===


It works as expected, but the the problem is that it display the FROM 
part as being send from ,my personal GMail account when it supposed to 
be shown the format variable field that was passed by index.html to the 
mail.py script.


Si there a workaround for that please?
--
Webhost http://superhost.gr
--
http://mail.python.org/mailman/listinfo/python-list


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-03 Thread feedthetroll
Am Dienstag, 3. September 2013 09:48:13 UTC+2 schrieb Ferrous Cranus:
 Hello,
 i have written the following snipper of code to help me send mail:
 ...
  server.login(nikos.gr...@gmail.com, ..)
HE DID IT AGAIN! The login works with the posted password!
Nikos, you should change your password IMMEDIATELY!

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


Re: How to execute command on remote windows machine

2013-09-03 Thread Jean-Michel Pichavant


- Original Message -
 Hi alex
 
 I tried the command you suggested however it is giving me following
 error.
 
 ERROR: The RPC server is unavailable.

Hi,

Please do not top post :)
If python is installed on the remote machine, using execnet 
http://codespeak.net/execnet/ is very easy. Its only requirement is python 
being installed on both machines.

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to split with \ character, and licence copyleft mirror of ©

2013-09-03 Thread Tim Chase
On 2013-09-03 02:06, Steven D'Aprano wrote:
 So the real bug is with the parser.
 
 It is likely that nobody noticed this bug in the first place
 because the current behaviour doesn't matter for regexes, which is
 the primary purpose of raw strings. You can't end a regex with an
 unescaped backslash, so r'abc\'' is an illegal regex and it doesn't
 matter if you can't create it.

I'd contend that the two primary purposes of raw strings (this is
starting to sound like a Spanish Inquisition sketch) are regexes and
DOS/Win32 file path literals.  And I hit this trailing-backslash case
all the time, as Vim's path-completion defaults to putting the
trailing backslash at the end.  So I might be entering a literal like

  rc:\win

and hit tab which expands to

  rc:\Windows\

for which I then need to both remove the backslash and close the
quote.  If Python's parser just blithely ignored terminal
backslashes, I could just close the quote and get on with my day.

-tkc



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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-03 Thread Ferrous Cranus

Στις 3/9/2013 12:33 μμ, ο/η feedthetr...@gmx.de έγραψε:

Am Dienstag, 3. September 2013 09:48:13 UTC+2 schrieb Ferrous Cranus:

Hello,
i have written the following snipper of code to help me send mail:
...
  server.login(nikos.gr...@gmail.com, ..)

HE DID IT AGAIN! The login works with the posted password!
Nikos, you should change your password IMMEDIATELY!

..
OMG!

I cannot believe i'm being *that* careless, so many times.


--
Webhost http://superhost.gr
--
https://mail.python.org/mailman/listinfo/python-list


Re: sqlite issue in 2.7.5

2013-09-03 Thread Alister
On Mon, 02 Sep 2013 22:13:27 +, Joseph L. Casale wrote:

 I have been battling an issue hopefully someone here has insight with.
 
 I have a database with a few tables I perform a query against with some
 joins against columns collated with NOCASE that leverage = comparisons.
 
 Running the query on the database opened in sqlitestudio returns the
 results in under a minute. Running the query in Python with sqlite3
 doesn't return results for several hours. I haven't figured out what
 pragmas or other shortcuts sqlitestudio uses to provide the results so
 fast.
 
 Using apsw returns the dataset nearly instantaneously but the
 connection/cursor/commit differences are too drastic and would force far
 too large a rewrite for the module change.
 
 Anyone by chance know the underlying changes required in the sqlite3
 module to replicate what sqlitestudio is doing behind the scenes?
 
 Thanks,
 jlc

you are almost certainly doing something drastically wrong
can you provides examples of your code  the data structure otherwise I 
doubt that anyone will be able to assist.




-- 
To err is human, to forgive, beyond the scope of the Operating System.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to execute command on remote windows machine

2013-09-03 Thread random832
On Tue, Sep 3, 2013, at 0:45, gaurangns...@gmail.com wrote:
 Hi Guys, 
 
 I have a requirement where i need to kill one process on remote windows
 machine. 
 Following command just works fine if i have to kill process on local
 machine 
 
 os.system('taskkill /f /im processName.exe')
 
 However I am not able to figure out how to execute this command on remote
 windows machine. 
 
 Note: my local machine is also windows (machine from where i have to
 execute command)
 
 so is there any way i can execute command from windows machine on remote
 windows machine ?

The taskkill command actually has an option for this: /S. I don't know
what mechanism it uses or what you would have to do to give yourself
permission to use it.


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


Unable to redirect the subprocess CMD.exe to txt file. Please help !!!

2013-09-03 Thread Venkatesh
Hello comp.lang.python Group,

I am trying to invoke a subprocess in Python as below 

import sys
import time
import os
import subprocess
DETACHED_PROCESS = 0x0008

path = r'C:\Windows\System32\cmd.exe /k ping www.google.com -n 4  temp.txt'
p = subprocess.Popen(%s%(path), stdout = subprocess.PIPE, stderr = 
subprocess.STDOUT, creationflags=DETACHED_PROCESS)

With this code, unable to invoke the subprocess and hence not able to store the 
Ping statistics in the file.

Any help on this OR any better way of achieving this??


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


Re: How to execute command on remote windows machine

2013-09-03 Thread Jean-Michel Pichavant

- Original Message - 

 I tried it, however it seems really complicated.

 If you have used it before, can you show me how can i do it ?

 Gaurang Shah
 Blog: qtp-help.blogspot.com
 Mobile: +91 738756556

Please don't ask question off-list.

It's not complicated at all.

The documentation has a lot of examples:
http://codespeak.net/execnet/example/test_info.html#execute-source-code-in-subprocess-communicate-through-a-channel

makegateway by defaut execute the code on the local machine. You simply need to 
use something like 
makegateway(ssh=myRemoteMachine)

cheers,

JM


-- IMPORTANT NOTICE: 

The contents of this email and any attachments are confidential and may also be 
privileged. If you are not the intended recipient, please notify the sender 
immediately and do not disclose the contents to any other person, use it for 
any purpose, or store or copy the information in any medium. Thank you.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to execute command on remote windows machine

2013-09-03 Thread 88888 Dihedral
gauran...@gmail.com於 2013年9月3日星期二UTC+8下午12時45分57秒寫道:
 Hi Guys, 
 
 
 
 I have a requirement where i need to kill one process on remote windows 
 machine. 
 
 Following command just works fine if i have to kill process on local machine 
 
 
 
 os.system('taskkill /f /im processName.exe')
 
 
 
 However I am not able to figure out how to execute this command on remote 
 windows machine. 
 
 
 
 Note: my local machine is also windows (machine from where i have to execute 
 command)
 
 
 
 so is there any way i can execute command from windows machine on remote 
 windows machine ?

This is trivial. First install the VNC on the remote site and 
make sure your VNC is working in the proper forground.

Just write a mouse/keyboard emulator service on the remote site 
with the propper port opened by python scripts.

Use the control computer  to send commands  to the remote site.

This scheme will work under unix-linux-windows OS.

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


Re: UnicodeDecodeError issue

2013-09-03 Thread Steven D'Aprano
On Tue, 03 Sep 2013 08:45:00 +1000, Chris Angelico wrote:

 On Tue, Sep 3, 2013 at 12:44 AM, MRAB pyt...@mrabarnett.plus.com
 wrote:
 I don't know Greek either, and I don't think there's any other language
 that uses the Greek alphabet.
 
 Assuming you don't count mathematics as a language.


There are a few languages which use the Greek alphabet, with variations. 
Coptic is the main one, although Greek and Coptic letters have their own 
Unicode symbols, in order to support works which need to distinguish them.

Armenian and, of course, Cyrillic, are derived from the Greek alphabet; 
actually so is the Latin alphabet.

Other languages that used, or use, the Greek alphabet include quite a few 
ancient languages, including Gaulish and Bactrian. Old Nubian in the 
Middle Ages used the Greek alphabet plus a few additional letters. A 
number of Slavic languages used the Greek alphabet, although now they use 
Cyrillic. Some Albanian dialects still use the Greek alphabet, as do a 
couple of Turkic languages from the Balkans. See the Wikipedia entry on 
the Greek alphabet for more.


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


Re: Unable to redirect the subprocess CMD.exe to txt file. Please help !!!

2013-09-03 Thread William Ray Wing
On Sep 3, 2013, at 9:54 AM, Venkatesh venkatesh.to...@gmail.com wrote:

 Hello comp.lang.python Group,
 
 I am trying to invoke a subprocess in Python as below 
 
 import sys
 import time
 import os
 import subprocess
 DETACHED_PROCESS = 0x0008
 
 path = r'C:\Windows\System32\cmd.exe /k ping www.google.com -n 4  temp.txt'
 p = subprocess.Popen(%s%(path), stdout = subprocess.PIPE, stderr = 
 subprocess.STDOUT, creationflags=DETACHED_PROCESS)
 
 With this code, unable to invoke the subprocess and hence not able to store 
 the Ping statistics in the file.
 
 Any help on this OR any better way of achieving this??
 
 
 -- 
 https://mail.python.org/mailman/listinfo/python-list


I use the following in OS-X, should be very similar in Windows.

   import subprocess
   ping_result = subprocess.Popen(['ping', '-c1', '-t1', self.target_IP], 
stderr=subprocess.PIPE, stdout = subprocess.PIPE).communicate()[0]

self.target_IP is a string containing the IP address, which is defined 
elsewhere.
ping_result contains the complete returned string from the ping command.  Note 
the -c switch (count = 1 ping packet) and the -t switch (force exit after one 
second).
you will have to parse the returned string to extract the stats.

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


Re: UnicodeDecodeError issue

2013-09-03 Thread wxjmfauth
Le lundi 2 septembre 2013 16:44:34 UTC+2, MRAB a écrit :
 On 02/09/2013 13:24, Dave Angel wrote:
 
  On 2/9/2013 07:56, MRAB wrote:
 
 
 
  On 02/09/2013 12:38, Dave Angel wrote:
 
 
 
  snip
 
 
 
  ¶γνωστοόνομα συστήματος
 
 
 
  I don't have a clue what it might be;  it's not English, and I don't
 
  know whatever language it may be in.
 
 
 
  You don't recognise Greek?
 
 
 
  I recognize most of those as Greek characters, but as I said, I don't
 
  know Greek.  And because I can't recognize words, I can't assume it
 
  might not be some other language that uses the same glyphs.
 
 
 
 I don't know Greek either, and I don't think there's any other language
 
 that uses the Greek alphabet.
 
 
 
 
 
  Does that string make any sense to you?  You may want to try it on your
 
  own machine, since the email may obscure the encoding.  Or you might
 
  want to do the decode using whatever the default encoding is for that
 
  server.
 
 
 
  The Linux 'file' utility thinks this string is in ISO-8859, so you might
 
  want to try a decode('ISO-8859-1') as well.  (and maybe  ISO-8859-2, -3,
 
  -4, and -5)
 
 
 
  It's ISO-8859-7 (Greek).
 
 



The Latin alphabet uses Greek lettering.

The Cyrillic alphabet uses Greek lettering.

Greek: One should not confuse modern Greek
with ancient Greek, polytonic Greek full
of diacritics.

Plenty of European languages (~15) based on the Latin
alphabet uses some ancient Greek diacritics.

Now unicode.

Everything is working very smoothly with the endorsed coding
schemes of Unicode.org.

Expectedly it fails (behaves badly) with Python and its 
Flexible Sting Representation, mainly because it relies on
the latin-1 (iso-8859-1) set.

To take the problem the other way, one can take these
linguistic ascpects to illustrate the wrong design of
the FSR.

jmf

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


Re: Unable to redirect the subprocess CMD.exe to txt file. Please help !!!

2013-09-03 Thread random832


On Tue, Sep 3, 2013, at 9:54, Venkatesh wrote:
 Hello comp.lang.python Group,
 
 I am trying to invoke a subprocess in Python as below 
 
 import sys
 import time
 import os
 import subprocess
 DETACHED_PROCESS = 0x0008
 
 path = r'C:\Windows\System32\cmd.exe /k ping www.google.com -n 4 
 temp.txt'
 p = subprocess.Popen(%s%(path), stdout = subprocess.PIPE, stderr =
 subprocess.STDOUT, creationflags=DETACHED_PROCESS)
 
 With this code, unable to invoke the subprocess and hence not able to
 store the Ping statistics in the file.
 
 Any help on this OR any better way of achieving this??

You should use /c, instead of /k. /k creates an interactive prompt.

I think you're being a bit overly complicated though by invoking cmd at
all. What about this?

subprocess.Popen(ping www.google.com -n 4,
stdout=open('temp.txt','a'), ...)
-- 
https://mail.python.org/mailman/listinfo/python-list


to be pythonic: should caller or callee log?

2013-09-03 Thread Gildor Oronar
What would you choose? Do you put logging routine into caller or callee? 
My intuitive answer is callee does the logging, because that's where 
action takes place, like this:


class Account():
def transaction(self, amount, target):
logging.info(Start transaction of %s to %s % (amount, target))
...

if '__name__' == '__main__'

account.transaction(amount, target)


Simple and easy. Put logging code to the caller would be tedious - the 
function is called about 20 times in different places.


So far so good, but we grew up to have 10 different account classes:

class AbsctractAccount():

class CreditAccount(AbstractAccount):
def transaction(self, amount, target):
logging.info(Start transaction of %s to %s % (amount, target))
...

class DebitAccount(AbstractAccount):
def transaction(self, amount, target):
logging.info(Start transaction of %s to %s % (amount, target))
...

class SomeOtherAccount(...)


Then letting the callee do the logging is also tedious now.

What is the best practise here?

If, for the convenience, we define transaction function in 
AbstractAccount to just do the logging, and change inherited classes, 
like this:


class AbsctractAccount():
def transaction(self, amount, target):
logging.info(Start transaction of %s to %s % (amount, target))

class DebitAccount(AbstractAccount):
def transaction(self, amount, target):
super().transaction(amount,target)


Then we gethered logging code pieces all to one place, but it begets two 
other problems.


1. It is a surprise that super().transaction must be called first, not 
last, and that it does only the logging.


2. The code used to check whether transaction is implemented:

if hasAttr(DebitAccount, 'transaction'): # clear to read

has to be changed to check whether transaction is inherited:

if not DebitAccount.transaction is AbstractAccount.transaction:

whose purpose is confusing, and whose cause is a little surprise too. 
Also, the pythonic boldly calling and watching for exception stopped 
working, because instead of getting AttributeError, we would get a line 
of log and nothing more.


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


Re: Editing tabular data

2013-09-03 Thread rusi
On Friday, August 2, 2013 12:05:53 PM UTC+5:30, Ben Finney wrote:
 Skip Montanaro writes:
 
  I really love Emacs, however... […]
 
  This is clearly a case where choosing the proper tool is important. I
  agree that using a spreadsheet to edit a 3x5 CSV file is likely
  overkill (might just as well use Notepad or TextEdit), but tabular
  data are tabular data, no matter how they might be delimited, and if
  there are many of those little data critters, there are better tools
  than a text editor (or Python IDE) for maintaining them.
 
 It seems an obvious thing for powerful text editors like Emacs and Vim
 to have a third-party mode for editing CSV data with a tabular
 interface.
 
 
 Indeed, such modes exist; one that I found immediately for Emacs is
 URL:http://www.emacswiki.org/emacs/csv-mode.el. Has anyone got a good
 Emacs mode for editing CSV data as a table and saving it back to CSV
 data?


Emacs users can have the cake and eat it too; ie use spreadsheet
functionality without having to use a separate spreadsheet file
and software.

The basic idea is to use org-mode which has a table
editor with spreadsheet functionality while continuing to live within a 
plain text editor.

It allows to edit a table entirely written in plain text in a visually 
appealing and clean way, while keeping a (less readable) python data
structure in sync with it.

The example file is below the ---

Caveats:
The orig_table string is there only make the source for the table.
The name orig_table is not necessary; a naked triple-string will also work.
The triple string is there to pacify python in the face of non valid syntax.
Ideal would have been comments but python does not have multiline comments

The table between the #BEGIN RECEIVE ORGTBL marks
and the #END RECEIVE ORGTBL marks
is the target or the recipient for the transformed version of the
plain text table.

Experiment as follows:
1. Save the stuff below - as something.py
2. Start editing the file in emacs

3. Join the 3 lines into 1 line with single space separators.
 +ORGTBL: SEND marks orgtbl-to-generic
  :lfmt   \%s\: [%s,%s,%s,%s,%s],
  :llfmt   \%s\: [%s,%s,%s,%s,%s]

   [It has to be one line, but if I kept it one line, it
   will be randomly be garbled in the mail!]

 This line gives the table a name (marks) so that you can use
 several tables in one file, and it specifies how the syntax should
 be changed when syncing the python version of  the table data.

4. Start orgtbl minor mode with M-x orgtbl-mode
   Mode line should show python and orgtbl

5. Delete the contents (keep the 2 # lines intact) of the python table

6. Place cursor within the orig_table and 'send' it as follows

7. Send is done with any one of 'C-c C-c' or 'C-u C-c C-c' or 'C-u C-u C-c C-c'
   The first just sends the table as is
   The second recomputes the formulas top-down and then sends
   The third recomputes until fixpoint (you really should not be making such a  
   table!!)

8. Play with the table editor by using TAB and S-TAB to
   walk through fields and change them, use C-u C-c C-c again to
   sync the python version of the table

9. In case the above does now work (if your orgmode is too old)
   the orig_table_2 should hopefully work even for older org versions
   It furthermore shows the ability to skip columns and to format
   column widths to convenience.

--
orig_table = 

#+ORGTBL: SEND marks orgtbl-to-generic
:lfmt   \%s\: [%s,%s,%s,%s,%s],
:llfmt   \%s\: [%s,%s,%s,%s,%s]
| abe|  1 |  2 |  3 |  4 |10 |
| beth   |  9 |  1 |  5 |  9 |24 |
| catherine |  5 |  6 |  7 |  5 |23 |
#+TBLFM: $6=$2+$3+$4+$5


stud_db = {
# Dont handedit
# BEGIN RECEIVE ORGTBL marks
  abe: [1,2,3,4,10],
  beth: [9,1,5,9,24],
  catherine: [5,6,7,5,23]
# END RECEIVE ORGTBL marks
}

## In case the above does not work (if org-version too old)

orig_table_2 = 

#+ORGTBL: SEND marks2 orgtbl-to-csv :skip 2
| Name   | T1 | T2 | T3 | T4 | Total |
| 6|||||   |
| abe|  1 |  2 |  3 |  4 |10 |
| beth   |  9 |  1 |  5 |  9 |24 |
| catherine |  5 |  6 |  7 |  5 |23 |
#+TBLFM: $6=$2+$3+$4+$5


stud_db_2 = {
# Dont handedit
# BEGIN RECEIVE ORGTBL marks2
abe,1,2,3,4,10
beth,9,1,5,9,24
catherine,5,6,7,5,23
# END RECEIVE ORGTBL marks2
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
On 2013-09-02, Roy Smith r...@panix.com wrote:
 In article mailman.508.1378143885.19984.python-l...@python.org,
  albert visser albert.vis...@gmail.com wrote:

 I like being able to do e.g.
 
  with open('some_file') as _in, open('another_file', 'w') as _out:

 It would be nice if you could write that as:

   with open('some_file'), open('another_file, 'w') as _in, _out:

3.2 and above provide contextlib.ExitStack, which I just now
learned about.

with contextlib.ExitStack() as stack:
_in = stack.enter_context(open('some_file'))
_out = stack.enter_context(open('another_file', 'w'))

It ain't beautiful, but it unfolds the nesting and gets rid of
the with statement's line-wrap problems.

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


Re: How to split with \ character, and licence copyleft mirror of ©

2013-09-03 Thread random832
On Tue, Sep 3, 2013, at 6:31, Tim Chase wrote:
 I'd contend that the two primary purposes of raw strings (this is
 starting to sound like a Spanish Inquisition sketch) are regexes and
 DOS/Win32 file path literals.  And I hit this trailing-backslash case
 all the time, as Vim's path-completion defaults to putting the
 trailing backslash at the end.  So I might be entering a literal like
 
   rc:\win
 
 and hit tab which expands to
 
   rc:\Windows\
 
 for which I then need to both remove the backslash and close the
 quote.  If Python's parser just blithely ignored terminal
 backslashes, I could just close the quote and get on with my day.

Of course, in 99% of situations where you can use a windows pathname in
Python, you are free to use it with a forward slash instead of a
backslash. The fact that you're using vim's file completion, which
automatically normalizes the path separator, is why you're running into
this issue when other people may not.

Maybe enabling the 'shellslash' option (which changes it to use forward
slash) will help you, though you should be aware this also affects the
expansion of the % variable, even in the :! command, which can cause
problems with certain usage patterns.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: semicolon at end of python's statements

2013-09-03 Thread Neil Cerutti
On 2013-09-03, Neil Cerutti ne...@norwich.edu wrote:
 3.2 and above provide contextlib.ExitStack, which I just now
 learned about.

 with contextlib.ExitStack() as stack:
 _in = stack.enter_context(open('some_file'))
 _out = stack.enter_context(open('another_file', 'w'))

 It ain't beautiful, but it unfolds the nesting and gets rid of
 the with statement's line-wrap problems.

It just occurred to me that in most of my use cases ExitStack
saves me from coming up with a name for the file objects at all,
since they are needed only to make csv objects.

Here's a csv file transformer pattern:

import contextlib
import csv

import transform

with contextlib.ExitStack() as stack:
reader = csv.DictReader(stack.enter_context(open('some_file', newline='')))
writer = csv.DictWriter(
stack.enter_context(open('another_file', 'w', newline='')),
fieldnames=reader.fieldnames)
writer.writeheader()
for record in reader:
writer.writerow(transform.transform(record))

Too bad it's so dense looking.

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


Re: PyPi Module Removal

2013-09-03 Thread Skip Montanaro
 I don't really have any way to contact the author of the module.  Is there
 any way to have this deleted/renamed?

Not directly, but I opened a ticked in the PyPI bug tracker.

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


Re: can't find win32api from embedded pyrun call

2013-09-03 Thread David M. Cotter
I find i'm having this problem, but the solution you found isn't quite specific 
enough for me to be able to follow it. 

I'm embedding Python27 in my app.  I have users install ActivePython27 in order 
to take advantage of python in my app, so the python installation can't be 
touched as it's on a user's machine.

When I attempt to do:
import win32api

i get this:
Traceback (most recent call last):
  File startup.py, line 5, in module
ImportError: DLL load failed: The specified module could not be found.

I someone suggested i manually load the dependent libraries in the correct 
order, like this:

import pywintypes
import pythoncom
import win32api

but then i get this:
Traceback (most recent call last):
  File startup.py, line 3, in module
  File C:\Python27\lib\site-packages\win32\lib\pywintypes.py, line 124, in 
 module
__import_pywin32_system_module__(pywintypes, globals())
  File C:\Python27\lib\site-packages\win32\lib\pywintypes.py, line 64, in 
 __import_pywin32_system_module__
import _win32sysloader
ImportError: DLL load failed: The specified module could not be found.

the ultimate goal here is actually to do this:
from win32com.client.gencache import EnsureDispatch

which currently yields:
Traceback (most recent call last):
  File startup.py, line 3, in module
  File C:\Python27\lib\site-packages\win32com\__init__.py, line 5, in 
 module
import win32api, sys, os
ImportError: DLL load failed: The specified module could not be found.

So, if anyone has any idea, that would be super duper great.  thanks so much!

notes: my paths are definitely set correctly
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPi Module Removal

2013-09-03 Thread Joel Goldstick
On Tue, Sep 3, 2013 at 4:52 PM, Joel Goldstick joel.goldst...@gmail.com wrote:
 On Tue, Sep 3, 2013 at 4:15 PM, Brian Rak b...@gameservers.com wrote:
 I was trying to install wxPython earlier today.  Not RTFMing, I tried
 'easy_install wx', which ended up installing this strange module:
 https://pypi.python.org/pypi/wx

 Looking at the download stats, it seems to be confusing ~1000 users a month,
 while not providing any significant functionality.

 I don't really have any way to contact the author of the module.  Is there
 any way to have this deleted/renamed?
 --
 https://mail.python.org/mailman/listinfo/python-list



 --
 Joel Goldstick
 http://joelgoldstick.com

Sorry for empty mail. You can use pip:

pip uninstall package



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPi Module Removal

2013-09-03 Thread Terry Reedy

On 9/3/2013 4:15 PM, Brian Rak wrote:

I was trying to install wxPython earlier today.  Not RTFMing, I tried
'easy_install wx', which ended up installing this strange module:
https://pypi.python.org/pypi/wx

Looking at the download stats, it seems to be confusing ~1000 users a
month, while not providing any significant functionality.

I don't really have any way to contact the author of the module.  Is
there any way to have this deleted/renamed?


There is a PyPI/catalog mailing list, which I believe is the one 
mirrored as gmane.comp.python.org at news.gmane.com. However, the PyPI
admins are reluctant to unilaterally delete a package. They might try to 
contact the owner of 'wx'. To bad wcPython did not grab the abbreviation.


--
Terry Jan Reedy

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


Re: PyPi Module Removal

2013-09-03 Thread Brian Rak

Thanks! Wasn't really sure where I should have reported that.

On 9/3/2013 4:56 PM, Skip Montanaro wrote:

I don't really have any way to contact the author of the module.  Is there
any way to have this deleted/renamed?

Not directly, but I opened a ticked in the PyPI bug tracker.

Skip


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


Re: PyPi Module Removal

2013-09-03 Thread Joel Goldstick
On Tue, Sep 3, 2013 at 4:15 PM, Brian Rak b...@gameservers.com wrote:
 I was trying to install wxPython earlier today.  Not RTFMing, I tried
 'easy_install wx', which ended up installing this strange module:
 https://pypi.python.org/pypi/wx

 Looking at the download stats, it seems to be confusing ~1000 users a month,
 while not providing any significant functionality.

 I don't really have any way to contact the author of the module.  Is there
 any way to have this deleted/renamed?
 --
 https://mail.python.org/mailman/listinfo/python-list



-- 
Joel Goldstick
http://joelgoldstick.com
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: to be pythonic: should caller or callee log?

2013-09-03 Thread Terry Reedy

On 9/3/2013 12:07 PM, Gildor Oronar wrote:

What would you choose? Do you put logging routine into caller or callee?
My intuitive answer is callee does the logging, because that's where
action takes place, like this:

class Account():
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

if '__name__' == '__main__'
 
 account.transaction(amount, target)


Simple and easy. Put logging code to the caller would be tedious - the
function is called about 20 times in different places.

So far so good, but we grew up to have 10 different account classes:

class AbsctractAccount():

class CreditAccount(AbstractAccount):
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

class DebitAccount(AbstractAccount):
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

class SomeOtherAccount(...)
 

Then letting the callee do the logging is also tedious now.

What is the best practise here?

If, for the convenience, we define transaction function in
AbstractAccount to just do the logging, and change inherited classes,
like this:

class AbsctractAccount():
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))

class DebitAccount(AbstractAccount):
 def transaction(self, amount, target):
 super().transaction(amount,target)
 

Then we gethered logging code pieces all to one place, but it begets two
other problems.

1. It is a surprise that super().transaction must be called first,


Not to me ;-). That is fairly standard in super examples I have seen posted.

 not last, and that it does only the logging.

If that is the only thing in common ...


2. The code used to check whether transaction is implemented:

  if hasAttr(DebitAccount, 'transaction'): # clear to read

has to be changed to check whether transaction is inherited:
 if not DebitAccount.transaction is AbstractAccount.transaction:

whose purpose is confusing, and whose cause is a little surprise too.


I would expect that every account class has a transaction method.
* If so, just call it, but
assertIsNot(DebitAccount.transaction, AbstractAccount.transaction)
for every subclass in your test suite.
* If not, perhaps you need an abstract subclass TransAccount. Then use 
hasattr in production code and the isnot test in test code.




Also, the pythonic boldly calling and watching for exception stopped
working, because instead of getting AttributeError, we would get a line
of log and nothing more.


This is what test suites are for.

--
Terry Jan Reedy

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


PyPi Module Removal

2013-09-03 Thread Brian Rak
I was trying to install wxPython earlier today.  Not RTFMing, I tried 
'easy_install wx', which ended up installing this strange module: 
https://pypi.python.org/pypi/wx


Looking at the download stats, it seems to be confusing ~1000 users a 
month, while not providing any significant functionality.


I don't really have any way to contact the author of the module.  Is 
there any way to have this deleted/renamed?

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


unbound method () must be called with ... instance as first argument (got nothing instead)

2013-09-03 Thread Mohsen Pahlevanzadeh
Dear all,

I have the following two lines code in my setup frame:
 // 
 self.showHideConstructor = ui.interface.interface.ShowHide()
 QtCore.QObject.connect(self.pushButtonAdd,
QtCore.SIGNAL(_fromUtf8(clicked())),self.showHideConstructor,ui.interface.interface.ShowHide.showFindMaterials())
//

and i have module ui.interface.interface , it contains ShowHide class,
and it consists showFindMaterials() method.

When i run program , i get the following traceback :
///
Traceback (most recent call last):
  File ./main.py, line 113, in module
main()
  File ./main.py, line 94, in main
interfaceObj.showMaterials()
  File /home/mohsen/codes/amlak/amlak/src/ui/interface/interface.py,
line 82, in showMaterials
self.ui.setupUi(self.Frame)
  File /home/mohsen/codes/amlak/amlak/src/ui/materialsFrame.py, line
92, in setupUi
QtCore.QObject.connect(self.pushButtonAdd,
QtCore.SIGNAL(_fromUtf8(clicked())),self.showHideConstructor,ui.interface.interface.ShowHide.showFindMaterials())
TypeError: unbound method showFindMaterials() must be called with
ShowHide instance as first argument (got nothing instead)
///

Where's problem?



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


Re: unbound method () must be called with ... instance as first argument (got nothing instead)

2013-09-03 Thread Mohsen Pahlevanzadeh
Solved, i changed my connect function to:
QtCore.QObject.connect(self.pushButtonAdd,
QtCore.SIGNAL(_fromUtf8(clicked())),self.showHideConstructor.showFindMaterials)
On Wed, 2013-09-04 at 02:00 +0430, Mohsen Pahlevanzadeh wrote:
 Dear all,
 
 I have the following two lines code in my setup frame:
  // 
  self.showHideConstructor = ui.interface.interface.ShowHide()
  QtCore.QObject.connect(self.pushButtonAdd,
 QtCore.SIGNAL(_fromUtf8(clicked())),self.showHideConstructor,ui.interface.interface.ShowHide.showFindMaterials())
 //
 
 and i have module ui.interface.interface , it contains ShowHide class,
 and it consists showFindMaterials() method.
 
 When i run program , i get the following traceback :
 ///
 Traceback (most recent call last):
   File ./main.py, line 113, in module
 main()
   File ./main.py, line 94, in main
 interfaceObj.showMaterials()
   File /home/mohsen/codes/amlak/amlak/src/ui/interface/interface.py,
 line 82, in showMaterials
 self.ui.setupUi(self.Frame)
   File /home/mohsen/codes/amlak/amlak/src/ui/materialsFrame.py, line
 92, in setupUi
 QtCore.QObject.connect(self.pushButtonAdd,
 QtCore.SIGNAL(_fromUtf8(clicked())),self.showHideConstructor,ui.interface.interface.ShowHide.showFindMaterials())
 TypeError: unbound method showFindMaterials() must be called with
 ShowHide instance as first argument (got nothing instead)
 ///
 
 Where's problem?
 
 
 


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


Conflict between Python 2.5 and 2.7

2013-09-03 Thread Errol Anderson
I look after a Delphi program that uses Python 2.5 (via Python for Delphi).
A customer who uses a modeling program that requires Python 2.7 experiences
a Python conflict when trying to run the Delphi program.  I have installed
both Python 2.5 and 2.7 on a test-bed computer and can run the Delphi
program.  I have searched the FAQ, and have found some mention of being able
to set a default Python version when installing, which I presume has
occurred when the customer installed Python 2.7, so that the Delphi program
is being directed to Python 2.7.

 

However, I do not see this option when I install Python 2.7, and I do not
see how to remove this option so I can advise the customer what to do.  The
programs are running under Windows 7 - 32-bit.   Any assistance gratefully
received.

 

Best regards

 

Errol Anderson

 

 

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


Re: Cannot form correctly the FORM part of the header when sending mail

2013-09-03 Thread Piet van Oostrum
Ferrous Cranus ni...@superhost.gr writes:

 Hello,
 i have written the following snipper of code to help me send mail:


[snip]

 # prepare mail data
 TO = ni...@superhost.gr

 SUBJECT = uMail από τον επισκέπτη: ( %s ) % FROM

 MESSAGE = From: %s\r\n + To: %s\r\n + Subject: %s\r\n
 + MESSAGE + \r\n
 MESSAGE = MESSAGE % ( FROM, TO, SUBJECT )
 MESSAGE = MESSAGE.encode('utf-8')

First a couple of remarks:
1. You should add an empty line between the headers and the message (I
suppose the message does not start with an empty line).
2. It is better to do the % substitution only on the headers, not
including the message, just in case the message contains a % sign.
That makes it:
 MESSAGE = From: %s\r\n + To: %s\r\n + Subject: %s\r\n\r\n % 
  ( FROM, TO, SUBJECT ) + MESSAGE + \r\n
 MESSAGE = MESSAGE.encode('utf-8')
3. It is bad coding style in Python to use all-caps variables. Better
use message instead of MESSAGE etc.

[snip]

 It works as expected, but the the problem is that it display the FROM
 part as being send from ,my personal GMail account when it supposed to
 be shown the format variable field that was passed by index.html to the
 mail.py script.

Where does it display that?
Do you happen to read that mail in a Microsoft program?
If yes, then it is the fault of that program. Read the mail in some
other program and you will probably see that the proper From address is
there.

The problem is that Gmail inserts a Sender header with your account
(email address) and certain Microsoft programs use that to display as
the From address instead of the real From address. It's against the
rules, but then, Microsoft makes its own rules and who is going to stop
them?

And maybe there are other mail programs that do the same. AFAIK there is
no way to get rid of that Sender line.
-- 
Piet van Oostrum p...@vanoostrum.org
WWW: http://pietvanoostrum.com/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: PyPi Module Removal

2013-09-03 Thread Steven D'Aprano
On Tue, 03 Sep 2013 16:15:07 -0400, Brian Rak wrote:

 I was trying to install wxPython earlier today.  Not RTFMing, I tried
 'easy_install wx', which ended up installing this strange module:
 https://pypi.python.org/pypi/wx
 
 Looking at the download stats, it seems to be confusing ~1000 users a
 month, while not providing any significant functionality.

Ah, Unix users. Who else would imagine that the way to install something 
called wxPython was to use install wx?

:-)



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


Re: to be pythonic: should caller or callee log?

2013-09-03 Thread Ethan Furman

On 09/03/2013 09:07 AM, Gildor Oronar wrote:

What would you choose? Do you put logging routine into caller or callee? My 
intuitive answer is callee does the
logging, because that's where action takes place, like this:

class Account():
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

So far so good, but we grew up to have 10 different account classes:

class AbsctractAccount():

class CreditAccount(AbstractAccount):
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

class DebitAccount(AbstractAccount):
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))
 ...

class SomeOtherAccount(...)
 

Then letting the callee do the logging is also tedious now.

What is the best practise here?

If, for the convenience, we define transaction function in AbstractAccount to 
just do the logging, and change inherited
classes, like this:

class AbsctractAccount():
 def transaction(self, amount, target):
 logging.info(Start transaction of %s to %s % (amount, target))

class DebitAccount(AbstractAccount):
 def transaction(self, amount, target):
 super().transaction(amount,target)
 


In this instance you're not really gaining anything by using inheritance: before you had one line for logging, after you 
have one line to call super(); in either case if you forget the one line you don't get a log entry.


I would say it is not really the caller's or the callee's job to do the logging, even though it should be done.  What 
would be really handy is a function that sat in between the caller and callee that logged for you -- you know, a decorator:


# not tested, but hopefully you get the idea
def log(func):
def wrapper(*args, **kwds):
text = []
if args:
text.append(str(args))
if kwds:
text.append(str(kwds))
text = ', '.join(text)
if text:
logging.info(%s called with %s % (func.__name__, text)
else:
logging.info(%s called % func.__name__)
return func(*args, **kwds)
return wrapper

Then you can say:

 class WhateverAccount:

@log
def transaction(self, amount, target):
...

True, you still one line, but moves the logging concern outside the function, where it doesn't really belong.  It also 
makes it really easy to see if a function will be logged or not.


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


Re: PyPi Module Removal

2013-09-03 Thread Skip Montanaro
 Ah, Unix users. Who else would imagine that the way to install something
 called wxPython was to use install wx?

I'm not a wxPython user, but it seems the package/module you import in your
programs is wx. Not an unreasonable guess at the PyPI package name.

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


Re: PyPi Module Removal

2013-09-03 Thread Brian Rak


On 9/3/2013 10:49 PM, Skip Montanaro wrote:



 Ah, Unix users. Who else would imagine that the way to install something
 called wxPython was to use install wx?

I'm not a wxPython user, but it seems the package/module you import in 
your programs is wx. Not an unreasonable guess at the PyPI package name.


Skip



Yep, that was my thinking entirely.  'import wx' = 'pip install wx'.  
Seems perfectly logical to me.

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


Re: can't find win32api from embedded pyrun call

2013-09-03 Thread David M. Cotter
note that when the script is called, i DO see this in the output window:

 'kJams 2 Debug.exe': Loaded 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
 'kJams 2 Debug.exe': Loaded 'C:\Windows\SysWOW64\pywintypes27.dll'
 'kJams 2 Debug.exe': Unloaded 
 'C:\Python27\Lib\site-packages\win32\win32api.pyd'
 'kJams 2 Debug.exe': Unloaded 'C:\Windows\SysWOW64\pywintypes27.dll'
-- 
https://mail.python.org/mailman/listinfo/python-list


Beginner's guide to Python

2013-09-03 Thread Steve Hayes
Can anyone recommend a web site that gives a good beginner's guide to Python?

One that tells one, especially --

-- what kind of projects Python is good for 
-- what kind of projects it is not good for
-- a simple explanation of how it works
-- a kind of beginner's tutotial and guide to its syntax

I've read about Python, and installed it on my computer when I found it on a
DVD that came with a magazine, but I haven't got a clue about how to use it.

So any advice on the best web sites for absolute novices would be welcome. 


-- 
Steve Hayes from Tshwane, South Africa
Blog: http://khanya.wordpress.com
E-mail - see web page, or parse: shayes at dunelm full stop org full stop uk
-- 
https://mail.python.org/mailman/listinfo/python-list


[issue18891] Master patch for content manager addtion to email package.

2013-09-03 Thread Stephen J. Turnbull

Stephen J. Turnbull added the comment:

I'm thinking this may be overengineering, but I may as well post it and find 
out for sure. :-)  Is it worth encapsulating MIME types?  They're really 
pairs as far as mail handling applications are concerned, but they have a 
string representation.  So

MacPorts 16:29$ python3.3
Python 3.3.2 (default, May 21 2013, 11:48:51) 
 from collections import namedtuple
 class MIMEType(namedtuple('MIMETYPE', 'type subtype')):
...  def __str__(self):
...   return {0}/{1}.format(self.type, self.subtype)
... 
 mt = MIMEType('text', 'plain')
 str(mt)
'text/plain'
 t, s = mt
 print('type =', t, 'subtype =', s)
type = text subtype = plain
 

Obviously there needs to be a constructor that handles the 'type/sub' 
represention.

--
nosy: +sjt

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Jeroen Van Goey

New submission from Jeroen Van Goey:

The sample code in the itertools.count documentation should be indented by 4 
spaces.

For 2.7.4: lines 3429 till 3432 in 
http://hg.python.org/releasing/2.7.4/file/026ee0057e2d/Modules/itertoolsmodule.c#l3429

For 3.4.0a1: lines 3981 till 3984 in 
http://hg.python.org/releasing/py3.4.0a1/file/edc668a667ad/Modules/itertoolsmodule.c#l3981

Also, the example code uses the arguments 'firstval' and 'step' whereas the 
documentation of the function itself uses the arguments 'start' and 'step'. 
Maybe better be consistent and use as first argument 'start' in both cases?

--
assignee: docs@python
components: Documentation
hgrepos: 207
messages: 196826
nosy: docs@python, jeroen-vangoey
priority: normal
severity: normal
status: open
title: Intendation issue in example code in itertools.count documentation
type: enhancement
versions: Python 2.7, Python 3.4

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Jeroen Van Goey

Changes by Jeroen Van Goey jeroen.vang...@gmail.com:


--
hgrepos:  -207

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Jeroen Van Goey

Jeroen Van Goey added the comment:

Patch for Python 2.7.4 attached

--
keywords: +patch
Added file: http://bugs.python.org/file31571/2.7itertoolsmodule.c.patch

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2013-09-03 Thread Antoine Pitrou

Antoine Pitrou added the comment:

 We don't have to align EVERY data structure.  But I do have immediate
 beneficial use cases for set tables and for data blocks in deque
 objects.

Can you explain what the use cases are, and post some benchmarking code?

Also, what would be the strategy? Would you align every set/deque, or only
the bigger ones?

--

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Jeroen Van Goey

Jeroen Van Goey added the comment:

Patch for Python 3.4.0a1 attached

--
Added file: http://bugs.python.org/file31572/3.4itertoolsmodule.c.patch

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



[issue18849] Failure to try another name for tempfile when directory with chosen name exists on windows

2013-09-03 Thread Vlad Shcherbina

Changes by Vlad Shcherbina vlad.shcherb...@gmail.com:


Removed file: http://bugs.python.org/file31518/fix_for_27.patch

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



[issue18849] Failure to try another name for tempfile when directory with chosen name exists on windows

2013-09-03 Thread Vlad Shcherbina

Changes by Vlad Shcherbina vlad.shcherb...@gmail.com:


Added file: http://bugs.python.org/file31573/temp_dir_exists_retry_27.patch

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



[issue18902] Make ET event handling more modular to allow custom targets for the non-blocking parser

2013-09-03 Thread Stefan Behnel

Stefan Behnel added the comment:

 This would make it possible to layer XMLPullParser on top of the stock 
 XMLParser coupled with a special target that collects events from the 
 callback calls.

Given that we have an XMLPullParser now, I think we should not clutter the API 
with more classes that do not add anything more than making other classes 
redundant. So, -1 on adding a special target that collects events. Anyone who 
wants to use that feature can just use the XMLPullParser.

In the Python implementation of that parser, custom targets can already be 
allowed right now. Only the C implementation prevents it currently (AFAICT) as 
it has its own built-in TreeBuilder target.

Therefore, +1 for the general cleanup to properly allow arbitrary targets as 
backend.

Also, +1 for allowing start-ns and end-ns event callbacks on parser targets, 
although that's a different feature entirely.

--
nosy: +scoder

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



[issue18851] subprocess's Popen closes stdout/stderr filedescriptors used in another thread when Popen errors

2013-09-03 Thread Jan-Wijbrand Kolman

Jan-Wijbrand Kolman added the comment:

Thanks you for the swift followup!

--

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



[issue18902] Make ElementTree event handling more modular to allow custom targets for the non-blocking parser

2013-09-03 Thread Stefan Behnel

Stefan Behnel added the comment:

(fixing subject to properly hit bug filters)

--
title: Make ET event handling more modular to allow custom targets for the 
non-blocking parser - Make ElementTree event handling more modular to allow 
custom targets for the non-blocking parser

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



[issue18849] Failure to try another name for tempfile when directory with chosen name exists on windows

2013-09-03 Thread Vlad Shcherbina

Changes by Vlad Shcherbina vlad.shcherb...@gmail.com:


Added file: http://bugs.python.org/file31574/temp_dir_exists_retry_33_34.patch

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

 The most natural approach is to have a special attribute set in the module's 
 global dict (for example: __REGRTEST_SUBPROCESS__ = True); however, there's a 
 slight problem with this approach - regrtest has to import the module to see 
 this attribute, and the module may do some work in its top-level code 
 (commonly, imports) that already needs to be done within a subprocess.

The main regrtest process can run auxilary child process which imports all test 
modules and says main process which of them have __REGRTEST_SUBPROCESS__=True.

It will be even better if the main process runs child process for testing all 
tests so when any test crashes it is possible to report this and respawn child 
process to continue testing other tests.

--

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



[issue18835] Add aligned memory variants to the suite of PyMem functions/macros

2013-09-03 Thread STINNER Victor

STINNER Victor added the comment:

Linux provides the following functions:

int posix_memalign(void **memptr, size_t alignment, size_t size);
void *valloc(size_t size);  # obsolete
void *memalign(size_t boundary, size_t size);  # obsolete

Windows provides the following functions:

void* _aligned_malloc(size_t size,  size_t alignment);
void _aligned_free(void *memblock);

_aligned_malloc() has a warning: Using free is illegal.

Do all platform provide at least a function to allocate aligned memory? 
Windows, Mac OS X, FreeBSD, old operating systems, etc.? If no, how should we 
handle these operating systems? Refuse to start Python? Disable some 
optimizations? How should we check in the source code (ex: setobject.c) than 
aligned allocations are not supported? An #ifdef?

***

Because of the Windows API, wee need at least two functions:

void* PyMem_MallocAligned(size_t size, size_t alignment);
void PyMem_FreeAligned(void *ptr);

The GIL must be held when callling these functions.


Windows provides also a realloc function:

void* _aligned_realloc(void *memblock, size_t size,  size_t alignment);

If the OS does not provide a realloc function, we can reimplement it (malloc, 
memcpy, free).

void* PyMem_ReallocAligned(void *ptr, size_t size, size_t alignment);

***

For the PEP 445: the new API is different than the PyMemAllocator structure 
because malloc and realloc functions have an extra alignment parameter. We 
can drop the parameter if the allocator has always the size alignment, but each 
object may require a different aligment?

--

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



[issue17862] itertools.chunks(iterable, size, fill=None)

2013-09-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

We should distinguish between at least two different functions. One generates 
slices of input sequence (it is especially useful for strings and bytes 
objects), and other groups items from arbitrary iterator into tuples. They have 
different applications.

--

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



[issue18911] minidom does not encode correctly when calling Document.writexml

2013-09-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

On Python 3 you should not only open file in text mode with specified encoding, 
but also specify the xmlcharrefreplace error handler.

doc.writexml(open(filename, w, encoding=utf-8, 
errors=xmlcharrefreplace), ,   , utf-8)

I can suggest only one solution -- explicitly document this behavior.

Perhaps we also should add a special module level function for writing DOM tree 
to binary file. Low-level writexml() should not be used directly.

--
nosy: +eli.bendersky, scoder, serhiy.storchaka
versions: +Python 3.3, Python 3.4

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Andrew Svetlov

Changes by Andrew Svetlov andrew.svet...@gmail.com:


--
stage:  - patch review

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Matěj Stuchlík

New submission from Matěj Stuchlík:

Doing 'valgrind --suppressions=Misc/valgrind-python.supp ./python 
Lib/tests/test_ssl.py' I'm getting:

==322== LEAK SUMMARY:
==322==definitely lost: 32 bytes in 1 blocks
==322==indirectly lost: 392 bytes in 16 blocks
==322==  possibly lost: 1,617,191 bytes in 1,052 blocks
==322==still reachable: 4,068,239 bytes in 3,201 blocks
==322== suppressed: 0 bytes in 0 blocks


I managed to reduce that to a shorter reproducer:


import os
import ssl

NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir, 
nullbytecert.pem)
p = ssl._ssl._test_decode_cert(NULLBYTECERT)


where NULLBYTECERT is the cert introduced in issue18709.

Python 2.7 does not leak like this, and the PySSL_test_decode_certificate 
function looks the same there as in Python 2.6, so I assume it's something else 
that does the actual leaking.

--
components: Extension Modules
messages: 196837
nosy: sYnfo
priority: normal
severity: normal
status: open
title: ssl._ssl._test_decode_cert seems to leak memory with certain 
certificates in Python 2.6
type: resource usage
versions: Python 2.6

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



[issue18849] Failure to try another name for tempfile when directory with chosen name exists on windows

2013-09-03 Thread Eli Bendersky

Eli Bendersky added the comment:

The fix looks good to me, in general. Could you create a test that goes along?

My only (minor) doubt is whether this should be generalized, in two dimensions:

1. PermissionError is mapped from both EACCES and EPERM. So to make the 2.7 
patch equivalent with 3.x, EPERM should also be checked. That said, Windows 
documents it doesn't really use EPERM 
(http://msdn.microsoft.com/en-us/library/5814770t.aspx).
2. Should this be restricted to Windows? Could there be other platforms that 
exhibit the same behavior? On the other hand, say on Linux, EACCES should not 
happen in a temp dir and so it's good to re-raise it. 

For (2) I don't think doing anything is necessary at this point - the added 
test may help because it can fail for some strange platform at some point and 
then the solution should be obvious. As for (1), adding EPERM into the 
condition probably can't hurt and it will make Python 2.7 behave more 
consistently with 3.x in case of some undocumented Windows behavior.

--
nosy: +eli.bendersky
stage: needs patch - patch review

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

To ensure it's a real memory leak: do the figures increase when the code is 
called in a loop?
I would not consider a single-time malloc (stored in some static variable) to 
be a leak.

--
nosy: +amaury.forgeotdarc

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Eli Bendersky

Eli Bendersky added the comment:

LGTM, thanks

--
nosy: +eli.bendersky

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8e174ee0575a by Eli Bendersky in branch '3.3':
Issue #18912: Fix indentation in docstring
http://hg.python.org/cpython/rev/8e174ee0575a

New changeset 31ef590a0d2f by Eli Bendersky in branch 'default':
Issue #18912: Fix indentation in docstring
http://hg.python.org/cpython/rev/31ef590a0d2f

--
nosy: +python-dev

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

That's a good idea:

NULLBYTECERT = os.path.join(os.path.dirname(__file__) or os.curdir, 
nullbytecert.pem)
for i in xrange(100):
p = ssl._ssl._test_decode_cert(NULLBYTECERT)

gives

==1647== LEAK SUMMARY:
==1647==definitely lost: 3,200 bytes in 100 blocks
==1647==indirectly lost: 39,200 bytes in 1,600 blocks
==1647==  possibly lost: 591,285 bytes in 545 blocks
==1647==still reachable: 1,955,652 bytes in 3,136 blocks
==1647== suppressed: 0 bytes in 0 blocks

so yes, they do increase.

--

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



[issue18912] Intendation issue in example code in itertools.count documentation

2013-09-03 Thread Roundup Robot

Roundup Robot added the comment:

New changeset a559cda6a498 by Eli Bendersky in branch '2.7':
Close #18912: Fix indentation in docstring
http://hg.python.org/cpython/rev/a559cda6a498

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

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-03 Thread Eli Bendersky

Eli Bendersky added the comment:

On Tue, Sep 3, 2013 at 2:32 AM, Serhiy Storchaka rep...@bugs.python.orgwrote:


 Serhiy Storchaka added the comment:

  The most natural approach is to have a special attribute set in the
 module's global dict (for example: __REGRTEST_SUBPROCESS__ = True);
 however, there's a slight problem with this approach - regrtest has to
 import the module to see this attribute, and the module may do some work in
 its top-level code (commonly, imports) that already needs to be done within
 a subprocess.

 The main regrtest process can run auxilary child process which imports all
 test modules and says main process which of them have
 __REGRTEST_SUBPROCESS__=True.

 It will be even better if the main process runs child process for testing
 all tests so when any test crashes it is possible to report this and
 respawn child process to continue testing other tests.


Well, if we go *that* way, my initial proposal would be to just always run
every test in a subprocess. Kind of what happens today with -jN, just also
for -j1. Since most people, and I assume bots, run -jN anyway, they already
see each test executed in a subprocess. Some folks didn't feel good about
it because the stress testing all in one process provides is apparently
desired.

Your proposal complicates the flow significantly, IMHO. I'd just run each
test in its own subprocess and be done with it.

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Jesús Cea Avión

Jesús Cea Avión added the comment:

Could you possibly check this in Python 2.7, 3.2 and 3.3?. Python 2.6 is open 
ONLY for security fixes, if any.

--
nosy: +jcea

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

Ah, that is unfortunate. I did check it for 2.7 and 3.4, neither of those leak, 
I can check it for the rest tomorrow, but I imagine it'll be the same story.

--

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



[issue18891] Master patch for content manager addtion to email package.

2013-09-03 Thread R. David Murray

R. David Murray added the comment:

It's an interesting thought.  It bothered me to be handling them as pure 
strings when writing the code.  It just felt wrong somehow :)

--

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



[issue5202] wave.py cannot write wave files into a shell pipeline

2013-09-03 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Here is corrected patch (it uses relative seek()) with a lot of tests.

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

http://hg.python.org/cpython/rev/c4bbda2d4c49 looks relevant.

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Amaury Forgeot d'Arc

Amaury Forgeot d'Arc added the comment:

Ah, http://hg.python.org/cpython/rev/80d491aaeed2/ as well then.

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

Potentially interesting part of the valgrind output:

==21685== 42,400 (3,200 direct, 39,200 indirect) bytes in 100 blocks are 
definitely lost in loss record 909 of 914
==21685==at 0x4A0887C: malloc (vg_replace_malloc.c:270)
==21685==by 0x331B06315F: CRYPTO_malloc (in /usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0x331B0CD4EE: sk_new (in /usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0x331B0F2E42: ??? (in /usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0x331B0F2F7B: ??? (in /usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0x331B0F2884: ASN1_item_ex_d2i (in 
/usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0x331B0F3103: ASN1_item_d2i (in /usr/lib64/libcrypto.so.1.0.1e)
==21685==by 0xB431892: _decode_certificate (_ssl.c:710)
==21685==by 0xB431E57: PySSL_test_decode_certificate (_ssl.c:1025)
==21685==by 0x49D187: PyEval_EvalFrameEx (ceval.c:3750)
==21685==by 0x497A01: PyEval_EvalCodeEx (ceval.c:3000)
==21685==by 0x497B41: PyEval_EvalCode (ceval.c:541)

_ssl.c:710 snippet:

(...)
 p = ext-value-data;
  if (method-it)
 names = (GENERAL_NAMES*) (ASN1_item_d2i(NULL, p, ext-value-length, 
 ASN1_ITEM_ptr(method-it)));
  else
  names = (GENERAL_NAMES*) (method-d2i(NULL, p, ext-value-length));
(...)

--

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



[issue18913] ssl._ssl._test_decode_cert seems to leak memory with certain certificates in Python 2.6

2013-09-03 Thread Matěj Stuchlík

Matěj Stuchlík added the comment:

That seems to be it, no more leaking! Good job!

--

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



[issue18709] SSL module fails to handle NULL bytes inside subjectAltNames general names (CVE-2013-4238)

2013-09-03 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
title: SSL module fails to handle NULL bytes inside subjectAltNames general 
names (CVE-2013-4238) - SSL module fails to handle NULL bytes inside 
subjectAltNames general names (CVE-2013-4238)

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



[issue18906] Create a way to always run tests in subprocesses within regrtest

2013-09-03 Thread Arfrever Frehtes Taifersar Arahesis

Changes by Arfrever Frehtes Taifersar Arahesis arfrever@gmail.com:


--
nosy: +Arfrever

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



[issue16662] load_tests not invoked in package/__init__.py

2013-09-03 Thread Zachary Ware

Zachary Ware added the comment:

I took a stab at the doc changes, attached here and including Barry's patch.

--
components: +Library (Lib)
type:  - enhancement
versions: +Python 3.4
Added file: http://bugs.python.org/file31575/16662_with_doc.diff

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



[issue18914] Python docs link to terrible outsi

2013-09-03 Thread Brian Mingus

New submission from Brian Mingus:

The python documentation links to an outside website for info and examples on 
http basic auth. This documentation is terrible and confusing. The link should 
be removed, and user's should be advised to use the Requests library.


# this example is from 
http://www.voidspace.org.uk/python/articles/authentication.shtml
# which is linked to by the official python docs 
http://docs.python.org/2/howto/urllib2.html

import urllib2
 
theurl = 'http://www.someserver.com/toplevelurl/somepage.htm'
username = 'johnny'
password = 'XX'
# a great password
 
passman = urllib2.HTTPPasswordMgrWithDefaultRealm()
# this creates a password manager
passman.add_password(None, theurl, username, password)
# because we have put None at the start it will always
# use this username/password combination for  urls
# for which `theurl` is a super-url
 
authhandler = urllib2.HTTPBasicAuthHandler(passman)
# create the AuthHandler
 
opener = urllib2.build_opener(authhandler)
 
urllib2.install_opener(opener)
# All calls to urllib2.urlopen will now use our handler
# Make sure not to include the protocol in with the URL, or
# HTTPPasswordMgrWithDefaultRealm will be very confused.
# You must (of course) use it when fetching the page though.
 
pagehandle = urllib2.urlopen(theurl)
# authentication is now handled automatically for us

--
assignee: docs@python
components: Documentation
messages: 196854
nosy: docs@python, mingus
priority: normal
severity: normal
status: open
title: Python docs link to terrible outsi
versions: Python 2.7

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread Ned Deily

Changes by Ned Deily n...@acm.org:


--
nosy: +michael.foord
title: Python docs link to terrible outsi - Confusing documentation in the 
urllib2 HOWTO

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



[issue16938] pydoc confused by __dir__

2013-09-03 Thread Ethan Furman

Ethan Furman added the comment:

I wonder if it would be better to have inspect.classify_class_attrs be improved 
instead?

--

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread Brian Mingus

Brian Mingus added the comment:

The documentation is confusing. Consider this comment:

# All calls to urllib2.urlopen will now use our handler
# Make sure not to include the protocol in with the URL, or
# HTTPPasswordMgrWithDefaultRealm will be very confused.
# You must (of course) use it when fetching the page though.

In the actual code he provides, he uses the protocol. Furthermore, before 
showing a simple way to use the libary, he shows a godawfully complex way. 

Either the documentation should made beautiful and comprehensible, or it should 
not be linked to.

--

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



[issue18891] Master patch for content manager addtion to email package.

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

On Sep 03, 2013, at 07:37 AM, Stephen J. Turnbull wrote:

I'm thinking this may be overengineering, but I may as well post it and find
out for sure. :-) Is it worth encapsulating MIME types?  They're really
pairs as far as mail handling applications are concerned, but they have a
string representation.

Neat idea.

--

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread R. David Murray

R. David Murray added the comment:

Suggesting using a 3rd party library in order to explain how to use the python 
standard library to do something isn't going to work.

Would you like to propose an alternate article or an improvement to the howto, 
using only stdlib facilities?

(Note that the external web page linked to is that of an active Python core 
contributor.)

--
nosy: +r.david.murray

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



[issue16039] imaplib: unlimited readline() from connection

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
nosy: +barry
priority: critical - release blocker

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



[issue18747] Re-seed OpenSSL's PRNG after fork

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
nosy: +larry
priority: normal - release blocker

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



[issue16201] socket.gethostbyname incorrectly parses ip

2013-09-03 Thread Charles-François Natali

Charles-François Natali added the comment:

Here's an updated patch with new tests.

It passes the regression test, and yields noticable performance improvements 
for IPv6:
before:
$ ./python -m timeit -s import socket; s = socket.socket(socket.AF_INET, 
socket.SOCK_DGRAM); DATA = b'hello' s.sendto(DATA, ('127.0.0.1', 4242)) 
1 loops, best of 3: 28 usec per loop
$ ./python -m timeit -s import socket; s = socket.socket(socket.AF_INET6, 
socket.SOCK_DGRAM); DATA = b'hello' s.sendto(DATA, ('::1', 4242)) 
1 loops, best of 3: 59.1 usec per loop
after:
$ ./python -m timeit -s import socket; s = socket.socket(socket.AF_INET, 
socket.SOCK_DGRAM); DATA = b'hello' s.sendto(DATA, ('127.0.0.1', 4242)) 
1 loops, best of 3: 24.8 usec per loop
$ ./python -m timeit -s import socket; s = socket.socket(socket.AF_INET6, 
socket.SOCK_DGRAM); DATA = b'hello' s.sendto(DATA, ('::1', 4242)) 
1 loops, best of 3: 26.7 usec per loop

Note that the tests aren't as good as I'd like them to, because apparently some 
systems (e.g. Solaris) have broken gethostbyaddr()...
But it's cleaner, more robust and more efficient.

--
Added file: http://bugs.python.org/file31576/parse_inet-1.diff

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



[issue16040] nntplib: unlimited readline() from connection

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
nosy: +barry
priority: critical - release blocker

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



[issue16038] ftplib: unlimited readline() from connection

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
nosy: +barry
priority: critical - release blocker

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



[issue16043] xmlrpc: gzip_decode has unlimited read()

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
priority: critical - release blocker

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



[issue16037] httplib: header parsing is not delimited

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
priority: critical - release blocker

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



[issue16042] smtplib: unlimited readline() from connection

2013-09-03 Thread Barry A. Warsaw

Barry A. Warsaw added the comment:

blocker for 2.6.9

--
priority: critical - release blocker

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread Brian Mingus

Brian Mingus added the comment:

Yes - this link was a waste of my time. It would have been better if it had not 
been there. I propose to replace it with nothing.

--

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread R. David Murray

R. David Murray added the comment:

The article is *explaining* basic auth, thus the pedegogy of the presentation, 
and why it is a see also and not part of the docs proper.

I'll admit I don't understand the first part of that comment, since the second 
part says you do have to put the protocol in the URL, which is what the example 
does.

As I said, would you care to propose a replacement?

--

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



[issue17487] wave.Wave_read.getparams should be more user friendly

2013-09-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka
stage: committed/rejected - patch review

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



[issue18914] Confusing documentation in the urllib2 HOWTO

2013-09-03 Thread Senthil Kumaran

Changes by Senthil Kumaran sent...@uthcode.com:


--
nosy: +orsenthil

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



[issue11126] Wave.py does not always write proper length in header

2013-09-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
resolution:  - invalid
stage:  - committed/rejected
status: pending - closed

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



[issue18878] Add support of the 'with' statement to sunau.open.

2013-09-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
nosy: +Claudiu.Popa

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



[issue18878] Add support of the 'with' statement to sunau.open.

2013-09-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka

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



[issue18901] sunau.getparams should return a namedtuple

2013-09-03 Thread Serhiy Storchaka

Changes by Serhiy Storchaka storch...@gmail.com:


--
assignee:  - serhiy.storchaka
nosy: +serhiy.storchaka

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



  1   2   >