[ANN] Summer School Advanced Scientific Programming in Python in Munich, Germany

2014-12-17 Thread Tiziano Zito

Advanced Scientific Programming in Python
=
a Summer School by the G-Node, the Bernstein Center for Computational
Neuroscience Munich and the Graduate School of Systemic Neurosciences

Scientists spend more and more time writing, maintaining, and debugging
software. While techniques for doing this efficiently have evolved, only
few scientists have been trained to use them. As a result, instead of doing
their research, they spend far too much time writing deficient code and
reinventing the wheel. In this course we will present a selection of
advanced programming techniques, incorporating theoretical lectures and
practical exercises tailored to the needs of a programming scientist. New
skills will be tested in a real programming project: we will team up to
develop an entertaining scientific computer game.

We use the Python programming language for the entire course. Python works
as a simple programming language for beginners, but more importantly, it
also works great in scientific simulations and data analysis. We show how
clean language design, ease of extensibility, and the great wealth of open
source libraries for scientific computing and data visualization are
driving Python to become a standard tool for the programming scientist.

This school is targeted at Master or PhD students and Post-docs from all
areas of science. Competence in Python or in another language such as Java,
C/C++, MATLAB, or Mathematica is absolutely required. Basic knowledge of
Python is assumed. Participants without any prior experience with Python
should work through the proposed introductory materials before the course.

Date and Location
=
August 31—September 5, 2015. Munich, Germany.

Preliminary Program
===

Day 0 (Mon Aug 31) — Best Programming Practices
  • Best Practices for Scientific Computing
  • Version control with git and how to contribute to Open
Source with github
  • Object-oriented programming  design patterns
Day 1 (Tue Sept 1) — Software Carpentry
  • Test-driven development, unit testing  quality assurance
  • Debugging, profiling and benchmarking techniques
  • Advanced Python: generators, decorators, and context managers
Day 2 (Wed Sept 2) — Scientific Tools for Python
  • Advanced NumPy
  • The Quest for Speed (intro): Interfacing to C with Cython
  • Contributing to Open Source Software/Programming in teams
Day 3 (Thu Sept 3) — The Quest for Speed
  • Writing parallel applications in Python
  • Python 3: why should I care
  • Programming project
Day 4 (Fri Sept 4) — Efficient Memory Management
  • When parallelization does not help:
the starving CPUs problem
  • Programming project
Day 5 (Sat Sept 5) — Practical Software Development
  • Programming project
  • The Pelita Tournament

Every evening we will have the tutors' consultation hour: Tutors will
answer your questions and give suggestions for your own projects.

Applications

You can apply on-line at https://python.g-node.org

Applications must be submitted before 23:59 UTC, March 31, 2015. 
Notifications of acceptance will be sent by May 1, 2015.

No fee is charged but participants should take care of travel, living, and
accommodation expenses. Candidates will be selected on the basis of their
profile. Places are limited: acceptance rate is usually around 20%.
Prerequisites: You are supposed to know the basics of Python to participate
in the lectures

Preliminary Faculty
===
• Francesc Alted, freelance developer, author of PyTables, Spain
• Pietro Berkes, Enthought Inc., UK
• Kathryn D. Huff, Department of Nuclear Engineering, University of
  California - Berkeley, USA
• Zbigniew Jędrzejewski-Szmek, Krasnow Institute, George Mason
  University, USA
• Eilif Muller, Blue Brain Project, École Polytechnique Fédérale de
  Lausanne, Switzerland
• Rike-Benjamin Schuppner, Institute for Theoretical Biology, 
  Humboldt-Universität zu Berlin, Germany
• Nelle Varoquaux, Centre for Computational Biology Mines ParisTech,
  Institut Curie, U900 INSERM, Paris, France
• Stéfan van der Walt, Applied Mathematics, Stellenbosch University,
  South Africa
• Niko Wilbert, TNG Technology Consulting GmbH, Germany
• Tiziano Zito, Forschungszentrum Jülich GmbH, Germany


Organized by Tiziano Zito (head) and Zbigniew Jędrzejewski-Szmek for the
German Neuroinformatics Node of the INCF Germany, Christopher Roppelt for
the German Center for Vertigo and Balance Disorders (DSGZ) and the Graduate
School of Systemic Neurosciences (GSN) of the Ludwig-Maximilians-Universität
Munich Germany, Christoph Hartmann for the Frankfurt Institute for Advanced
Studies (FIAS) and International Max Planck Research School (IMPRS) for
Neural Circuits, Frankfurt Germany, and Jakob Jordan for the Institute of
Neuroscience and Medicine (INM-6) and Institute for Advanced Simulation
(IAS-6), Jülich Research Centre and JARA. Additional funding provided by the
Bernstein Center for Computational 

[ANN]: distlib 0.2.0 released on PyPI

2014-12-17 Thread Vinay Sajip
I've just released version 0.2.0 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

Updated match_hostname to use the latest Python implementation.

Updates to better support PEP 426 / PEP 440.

You can now provide interpreter arguments in shebang lines written
by distlib.

Removed reference to __PYVENV_LAUNCHER__ (relevant to OS X only).

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for
improvements, please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.python.org/pypi/distlib/0.2.0
[2] http://pythonhosted.org/distlib/overview.html#change-log-for-distlib
[3] https://bitbucket.org/pypa/distlib/issues/new
-- 
https://mail.python.org/mailman/listinfo/python-announce-list

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


how can i get the file on my local pc from vps ip with paramiko or by some other way?

2014-12-17 Thread pengsir
I have an vps ,my local pc is in the local area network. When paramiko 
installed on my local pc ,i can get file from my vps.


import paramiko
t = paramiko.Transport((vps ip,22))
t.connect(username = username, password = key)
sftp = paramiko.SFTPClient.from_transport(t)
remotepath='/tmp/test.txt'
localpath='/tmp/test.txt'
sftp.get(remotepath,localpath)

Now the problem is :how can i get the file on my local pc from vps ip 
with paramiko or by some other way?


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


Re: xml SAX Parsing in python

2014-12-17 Thread Stefan Behnel
Hi,

Abubakar Roko schrieb am 17.12.2014 um 07:30:
 Please I am new in using python to write program. I am trying to parse an XML 
 document using sax parse  and store the parsed result in a tree like 
 definedbelow. XNode class define an xml element which has an ID , a tag, a 
 text value, children element and a parent element
class XNode(object):
 def __init__(self, ID =, elmName=, 
 elmValue=, parent=None):
  self.ID = ID 
 self.elmName=elmName self.elmValue=elmValue   
   self.childs=[]
 self.parent=parent
 
def  getPath(self):
   if self.parent is None:   return 
 self.elmName else:
return self.parent.getPath()+/+ self.elmName
 I  wrote a program that parse an XML document ,  convert the  document  into 
 the tree like structure defined above and then return the parsed result tothe 
 program that call it.  The program shown below.
 
 import xml.saximport XMLnode as n
 
 class XML_Handler ( xml.sax.ContentHandler):
 def __init__(self, root):self.root = rootself.tmp =  
 n.XNode()
 def startElement(self, tag, attributes):#if self.root != None:
 if self.root is not None:
 if len(self.tmp.childs)  10:ID = self.tmp.ID 
 +. + 0 + str( len(self.tmp.childs))else:ID = 
 self.tmp.ID +. + str( len(self.tmp.childs)) 
 self.tmp.childs.append( n.XNode(ID,tag,,self.tmp)) 
 self.tmp= self.tmp.childs[len(self.tmp.childs)-1]else:
 print 0, tag, self.tmp.getPath()self.root= n.XNode(0, 
 tag,,None)self.tmp=self.root
 def characters(self, content):self.tmp.elmValue += content.strip()
 def endElement(self, tag):self.tmp= self.tmp.parent
 
 def parse(self, f):xml.sax.parse(self,f)return self.root
 
 if ( __name__ == __main__):
  parser = xml.sax.make_parser() 
 parser.setFeature(xml.sax.handler.feature_namespaces, 0) root = None
 Handler = XML_Handler(root)parser.setContentHandler( Handler )
 treRoot= parser.parse(Movies.xml)print treRoot
 Can somebody help me answer the following questionMy Question is how do I 
 return the parsed result through the root instance variable of  of 
 XML_Handler classI try to do it but i always get None as answerI am using 
 Window 7 professional and python 2.7

The formatting of your code example was heavily screwed up, please send a
plain text email next time.

My general advice is to use ElementTree instead of SAX. It's way easier to
use (even for simple tasks). Use iterparse() to get event driven
incremental parsing.

https://docs.python.org/3/library/xml.etree.elementtree.html#xml.etree.ElementTree.iterparse

http://effbot.org/zone/element-iterparse.htm

Stefan


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


Re: uWSGI, nGinx, and python on Wheezy: how do you configure it?

2014-12-17 Thread Veek M
Dumped uwsgi - the documentation is utterly ridculous!! 

Switched to 'Bottle' - very nice, intutive and clean - 
tutorial+documentation is excellent and i got 'hello world' up and running 
in like 10-15 minutes vs the 2 days intermittent it took to scroll through 
the crap that is uwsgi-server. It's got a built in web-server, so no need to 
mess with nginx. http://bottlepy.org/docs/dev/index.html

I think i'll like Flask too - there's a book: Flask Web Development: 
Developing Web Applications with Python


Seriously though, it takes a dev about 15 minutes to scrawl out a line-
diagram, scan it, and upload, explaining WTH is going on with his whole 
project - i'll take a 10 MB GIF anyday, vs wasting 1 day flat just staring 
in shock at 'Greenlets' and uwsig protocol and thw WSGI spec and the uWSGI 
server.. here's a quote:

Loop engines (implement events and concurrency, components can be run in 
preforking, threaded, asynchronous/evented and green thread/coroutine modes. 
Various technologies are supported, including uGreen, Greenlet, Stackless, 
Gevent, Coro::AnyEvent, Tornado, Goroutines and Fibers)

Somebody reading that might mistake it for the Mars landing.


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


Classes - delegation question.

2014-12-17 Thread Ivan Evstegneev
Hello guys,

I have a question about delegation coding pattern(I'm working with Python
3.4).
In order to describe my question , I'll provide particular example:

Let assume I have two classes written in module named person.py:


Case 1:

class Person:
def __init__(self, name, job = None, pay =0):
self.name = name
self.job = job
self.pay = pay
def lastName(self):
return self.name.split()[-1]
def giveRaise(self, percent):
self.pay = int(sel.pay * (1 + percent))
def __repr__(self):
return '[Person: %s, %s]' % (self.name, self.pay)

class Manager(Person):
def giveRaise(self, percent, bonus = .10):
Person.giveRaise(self, percent + bonus)


Case 2: 


class Person: 
the same...

class Manager: 
def __init__(self, name, pay):
self.person = Person(name, 'mgr', pay)
def giveRaise(self, percent, bonus = .10):
self.person.giveRaise(percent + bonus)
def __getattr__(self, attr):
return getattr(self.person, attr)
def __repr__(self):
return str(self.person) 

 
I also used some test code proposed by the book:

if __name__ == '__main__':
bob = Person('Bob Smith')
sue = Person('Sue Jones', job='dev', pay=10)
print(bob)
print(sue)
print(bob.lastName(), sue.lastName())
sue.giveRaise(.10)
print(sue)
tom = Manager('Tom Jones', 5) # Job name not needed:
tom.giveRaise(.10)

print(tom.lastName())
print(tom)


As I can understand from the above code : 

When code looks like in  Case 1, it actually works with standard
inheritance model. (with sub and super-class definitions).
Also according to the book:
***
This code leverages the fact that a class's method can always be called
either through
an instance (the usual way, where Python sends the instance to the self
argument
automatically) or through the class (the less common scheme, where you must
pass the
instance manually). In more symbolic terms, recall that a normal method call
of this
form:
instance.method(args...)
is automatically translated by Python into this equivalent form:
class.method(instance, args...)
 ***

Furthermore:

***
Python provides it automatically only for calls made through an instance.
For calls 
through the class name, you need to send an instance to self yourself; for
code inside 
a method like giveRaise, self already is the subject of the call, and hence
the instance 
to pass along.
Calling through the class directly effectively subverts inheritance and
kicks the call
higher up the class tree to run a specific version.


What is considered as a call in this context?

Is it a code inside class method?

For instance(relates to the Case 1):

def giveRaise(self, percent, bonus = .10):
Person.giveRaise(self, percent + bonus)

The call will be : Person.giveRaise(self, percent + bonus)   ?

In such a case, when I create an instance:

 tom = Manager('Tom Jones', 5)

and then invoke giveRaise method 

 tom.giveRaise(.10)

I essentially say this:

class.method(instance, args...) 

Where class is Person and method is giveRaise and instance is tom?

Moreover, because of how it defined (a method giveRaise), I make a call
through the class name?

What is the call through instance? 

Is it this one(according to Case 1):

class Person:
...
def giveRaise(self, percent):
self.pay = int(sel.pay * (1 + percent))
...

and then:

 bob = Person('Bob Smith', 'dev', 3)
 bob.giveRaise(.10) Is this call through instance? 



Questions regard to Case 2 example:

class Person: 
the same...

class Manager: 
def __init__(self, name, pay):
self.person = Person(name, 'mgr', pay)   ---
Initialization of Manager's attribute named  'self.person and embedding  a
Person object. 

def giveRaise(self, percent, bonus = .10): --
Defenition of Manager's method named giveRaise and according to the book:
self.person.giveRaise(percent + bonus)   Intercept and
delegate
..

My question here is substantially the same:

On the one hand we embedding Person into Manager class, 

On the other hand, when I write this code:

 tom = Manager('Tom Jones', 5000)

I create an instance of Manager that have an attribute named: tom.person,
which in turn is a class named Person.

And when typing:

tom.giveRaise(.10)

I do kinda same thing. 
For my assumption I say:

Person.giveRaise( percent + bonus) (when 

smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread radzhome
smtplib.SMTPRecipientsRefused: {'aahlin!@gmail.com': (550, 'restricted 
characters in address')}

As in this question, the answer has reference to RFCs that spec it out, and 
state that exclamations are ok, so why is smptplib throwint this error?

http://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-email-address

Django uses smtplib to send emails so it in turn fails too but email validation 
allows you to enter !
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: xml SAX Parsing in python

2014-12-17 Thread Ian Kelly
On Tue, Dec 16, 2014 at 11:30 PM, Abubakar Roko
abr...@yahoo.com.dmarc.invalid wrote:

 Good day,

 Please I am new in using python to write program. I am trying to parse an
XML document using sax parse  and store the parsed result in a tree like
defined
 below. XNode class define an xml element which has an ID , a tag, a text
value, children element and a parent element

class XNode(object):

 def __init__(self, ID =, elmName=,
elmValue=, parent=None):

  self.ID = ID
  self.elmName=elmName
  self.elmValue=elmValue
  self.childs=[]
 self.parent=parent


def  getPath(self):
   if self.parent is None:
return self.elmName
  else:
return self.parent.getPath()+/+
self.elmName

 I  wrote a program that parse an XML document ,  convert the  document
 into the tree like structure defined above and then return the parsed
result to
 the program that call it.  The program shown below.

I'm not sure why you would want to use a SAX parser for this. The advantage
of incremental parsing is that you never have to have the whole document in
memory at once. If you use it to construct some DOM-like structure from the
document, then you're going to have the whole document in memory anyway,
and you might as well just use one of the existing implementations (e.g.
ElementTree) rather than reinventing your own.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Ervin Hegedüs
Hi,

On Wed, Dec 17, 2014 at 08:16:23AM -0800, radzh...@gmail.com wrote:
 smtplib.SMTPRecipientsRefused: {'aahlin!@gmail.com': (550, 'restricted 
 characters in address')}
 
 As in this question, the answer has reference to RFCs that spec it out, and 
 state that exclamations are ok, so why is smptplib throwint this error?
 
 http://stackoverflow.com/questions/2049502/what-characters-are-allowed-in-email-address
 
 Django uses smtplib to send emails so it in turn fails too but email 
 validation allows you to enter !

I think that this exception came from your SMTP server, not from
smtplib. Check your smtpd log.

You can try to send through that smtpd at another way (eg.
netcat) with that address - may be then you can check the result.


a.

-- 
I � UTF-8
-- 
https://mail.python.org/mailman/listinfo/python-list


signal.signal handler arity check - PEP?

2014-12-17 Thread Mike Pomraning
It strikes me as oddly dangerous that signal.signal() accepts callable handlers 
of the wrong arity:

def timeout_cleanup():
  ...

signal.signal(signal.SIGALRM, timeout_cleanup)   # I desire a TypeError 
here
signal.alarm(PROCESS_TIMEOUT)

... time passes ...

TypeError: timeout_cleanup() takes 0 positional arguments but 2 were given

(Similar TypeError with different text under python 2.)

The downside to current behavior is that the coding error is revealed only 
under certain conditions at runtime.  In the example above, you don't know that 
your seatbelt is defective until you need it.

Does anyone disagree with modifying signal.signal's behavior to raise a 
TypeError when given a user-defined handler of the wrong arity?  Any code 
relying on this behavior is, IMO, contrived beyond plausibility.  However, this 
change might break code not yet known to be incorrect.

If no disagreements, patch or PEP?

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


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Radomir Wojcik
thanks i'll try that, I can also telnet on the server and see what I get if I 
use that recipient. I'm using exim, not sure why it would have that restriction
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Radomir Wojcik
thanks i'll try that, I can also telnet on the server and see what I get if I 
use that recipient. I'm using exim, not sure why it would have that restriction
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Radomir Wojcik
No need to do more troubleshooting, need to update the config. Found that exim 
default config denies these so nothing to do with smptlib indeed:

What this statement is doing is to accept unconditionally all recipients in 
messages that are submitted by SMTP from local processes using the standard 
input and output (that is, not using TCP/IP). A number of MUAs operate in this 
manner.

denymessage   = Restricted characters in address
domains   = +local_domains
local_parts   = ^[.] : ^.*[@%!/|]

denymessage   = Restricted characters in address
domains   = !+local_domains
local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
These statements are concerned with local parts that contain any of the 
characters @, %, !, /, |, or dots in unusual places. Although these 
characters are entirely legal in local parts (in the case of @ and leading 
dots, only if correctly quoted), they do not commonly occur in Internet mail 
addresses.

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Radomir Wojcik
Its all in here for those using exim4

http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html

I went into /etc/exim4 and ran this command to find where the deny message is 
stored, which lead me to the regex variable CHECK_RCPT_LOCAL_LOCALPARTS. So I 
searched for it, updated the values and restarted exim:

grep -r CHECK_RCPT_LOCAL_LOCALPARTS *

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


Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
I know about the schedule modules and such but they work in situations like
'run this in a X hours/minutes/seconds interval', I already have my code in
a while loop with sleep (it's a bit ugly, I'l change to a scheduler soon).

What I really want is, for example:

24/7/365
9:00 AM - Start
11:59 PM - Stop

9:00 AM ~ 11:50 PM - Running
12:00 AM ~ 8:59 AM - Stopped

I want my script to start at a given time and stop at another given time,
is that possible?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to schedule my script?

2014-12-17 Thread John Gordon
In mailman.17010.1418843457.18130.python-l...@python.org Juan Christian 
juan0christ...@gmail.com writes:

 --047d7b874b2c1e67eb050a6e3cc4
 Content-Type: text/plain; charset=UTF-8

 I know about the schedule modules and such but they work in situations like
 'run this in a X hours/minutes/seconds interval', I already have my code in
 a while loop with sleep (it's a bit ugly, I'l change to a scheduler soon).

 What I really want is, for example:

 24/7/365
 9:00 AM - Start
 11:59 PM - Stop

 9:00 AM ~ 11:50 PM - Running
 12:00 AM ~ 8:59 AM - Stopped

 I want my script to start at a given time and stop at another given time,
 is that possible?

You could write a separate program whose only job is to send a STOP or
CONTINUE signal to your main program, and then run that program from a
scheduler.

The standard system kill command would probably work for this purpose,
assuming you have access to your main program's process ID.

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

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


[ANN]: distlib 0.2.0 released on PyPI

2014-12-17 Thread Vinay Sajip
I've just released version 0.2.0 of distlib on PyPI [1]. For newcomers,
distlib is a library of packaging functionality which is intended to be
usable as the basis for third-party packaging tools.

The main changes in this release are as follows:

Updated match_hostname to use the latest Python implementation.

Updates to better support PEP 426 / PEP 440.

You can now provide interpreter arguments in shebang lines written
by distlib.

Removed reference to __PYVENV_LAUNCHER__ (relevant to OS X only).

A more detailed change log is available at [2].

Please try it out, and if you find any problems or have any suggestions for
improvements, please give some feedback using the issue tracker! [3]

Regards,

Vinay Sajip

[1] https://pypi.python.org/pypi/distlib/0.2.0
[2] http://pythonhosted.org/distlib/overview.html#change-log-for-distlib
[3] https://bitbucket.org/pypa/distlib/issues/new
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 5:45:31 PM John Gordon gor...@panix.com wrote:
You could write a separate program whose only job is to send a STOP or
CONTINUE signal to your main program, and then run that program from a
scheduler.

The standard system kill command would probably work for this purpose,
assuming you have access to your main program's process ID.

There isn't any 'prettier' way? Such as a built-in or third-party module
for something common like that?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
Ops, sorry.

It's: 9:00 AM ~ 11:59 PM - Running

... and not 9:00 AM ~ 11:50 PM - Running
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple background sound effect playback

2014-12-17 Thread Jacob Kruger
Ok, trying simple code from a pygame tutorial snippet - nothing happens - just 
silent, but with no errors being returned:

# play a sound to the left, to the right and to the center

# import the time standard module
import time

# import the pygame module
import pygame


# start pygame
pygame.init()

# load a sound file into memory
sound = pygame.mixer.Sound(bird.ogg)

# start playing the sound
# and remember on which channel it is being played
channel = sound.play()
# set the volume of the channel
# so the sound is only heard to the left
channel.set_volume(1, 0)
# wait for 1 second
time.sleep(1)

# do the same to the right
channel = sound.play()
channel.set_volume(0, 1)
time.sleep(1)

# do the same to the center
channel = sound.play()
channel.set_volume(1, 1)
time.sleep(1)
#end code

Think this is why ignored pygame in past...smile - think it actually needs 
more than itself to be installed, or something.

Jacob Kruger
Blind Biker
Skype: BlindZA
...Roger Wilco wants to welcome you, to the space janitor's closet...

  - Original Message - 
  From: Ian Kelly 
  To: Python 
  Sent: Wednesday, December 17, 2014 3:49 AM
  Subject: Re: Simple background sound effect playback


  On Tue, Dec 16, 2014 at 9:57 AM, Jacob Kruger ja...@blindza.co.za wrote:
  
   Would prefer to use something free, that could work somewhat 
cross-platform, but, my primary target is for windows OS, and would primarily 
just want to be able to easily trigger playback of either .wav or .mp3 
background sound effects, but, yes, would also be nice to be able to control 
them a little bit in terms of volume, possibly stereo panning as well as 
playback rate/frequency/pitch?

   I have used something called sound_lib, as well as another one relating to 
a sort of windows directSound effect, but, both of them had issues when working 
with either py2exe or cx_freeze when it came to compiling into executable, and 
main thing is would like to keep it simple...smile

   Suggestions?


  https://wiki.python.org/moin/Audio/


--


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


Re: Is there a way to schedule my script?

2014-12-17 Thread John Gordon
In mailman.17012.1418845926.18130.python-l...@python.org Juan Christian 
juan0christ...@gmail.com writes:

 The standard system kill command would probably work for this purpose,
 assuming you have access to your main program's process ID.

 There isn't any 'prettier' way? Such as a built-in or third-party module
 for something common like that?

If you're on Unix, 'kill' and 'cron' are already built-in.

If you want to solve your problem entirely within Python, look at the
scheduler module.  (Although even this isn't a complete solution, as you
still have to make sure the program is running in the first place...)

-- 
John Gordon Imagine what it must be like for a real medical doctor to
gor...@panix.comwatch 'House', or a real serial killer to watch 'Dexter'.

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 6:25:39 PM John Gordon gor...@panix.com wrote:
If you want to solve your problem entirely within Python, look at the
scheduler module. (Although even this isn't a complete solution, as you
still have to make sure the program is running in the first place...)


My script is running fine, Win/OSX/Linux and I don't want to ruin that
using system specific things.

I looked at sched doc and it's only for creating a delay, maybe a good
approach would be to call the sched and check if time = 11:59PM, then set
delay to 1h and when the time goes 9AM, it returns to my normal delay.

Is there any kind of time calculation in Python that counts the time like
0, 1, 2, 3... so that 0AM would be 0, and 11:59PM would be let's say
'64562'? And everyday it gets a reset when the clock 'turns'?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Michael Ströder
Radomir Wojcik wrote:
 No need to do more troubleshooting, need to update the config. Found that 
 exim default config denies these so nothing to do with smptlib indeed:
 
 What this statement is doing is to accept unconditionally all recipients in 
 messages that are submitted by SMTP from local processes using the standard 
 input and output (that is, not using TCP/IP). A number of MUAs operate in 
 this manner.
 
 denymessage   = Restricted characters in address
 domains   = +local_domains
 local_parts   = ^[.] : ^.*[@%!/|]
 
 denymessage   = Restricted characters in address
 domains   = !+local_domains
 local_parts   = ^[./|] : ^.*[@%!] : ^.*/\\.\\./
 These statements are concerned with local parts that contain any of the 
 characters @, %, !, /, |, or dots in unusual places. Although these 
 characters are entirely legal in local parts (in the case of @ and leading 
 dots, only if correctly quoted), they do not commonly occur in Internet mail 
 addresses.
 
 http://www.exim.org/exim-html-current/doc/html/spec_html/ch-the_default_configuration_file.html

You should really think about why these chars were excluded in the
configuration: The reason is that those they are special in shells.

And many SMTP deployments have pretty naive (shell) scripts or software with
shell exits. So allowing those chars can cause more or less big security
risks. For this reason it's likely that you will end in spam filters / black
lists etc. because systems may assume you want to do some harm.

So I would really rethink the requirements.

Your mileage may vary. But you have been warned.

Ciao, Michael.

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Chris Angelico
On Thu, Dec 18, 2014 at 7:42 AM, Juan Christian
juan0christ...@gmail.com wrote:
 Is there any kind of time calculation in Python that counts the time like 0,
 1, 2, 3... so that 0AM would be 0, and 11:59PM would be let's say
 '64562'? And everyday it gets a reset when the clock 'turns'?

time.time() % 86400

That's number of seconds since midnight UTC, ranging from 0 up to
86399. (I've no idea what 64562 would mean. That's an awfully big
number for a single day.) If you offset that before calculating, you
can get that in your local time. Otherwise, just do the arithmetic
directly. Time isn't all _that_ hard to work with.

I don't see what's the big problem with just using sleep() though.
Isn't that exactly what you're after?

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 7:35:10 PM Chris Angelico ros...@gmail.com wrote:

time.time() % 86400

That's number of seconds since midnight UTC, ranging from 0 up to
86399. (I've no idea what 64562 would mean. That's an awfully big
number for a single day.) If you offset that before calculating, you
can get that in your local time. Otherwise, just do the arithmetic
directly. Time isn't all _that_ hard to work with.

I don't see what's the big problem with just using sleep() though.
Isn't that exactly what you're after?

This was a random number I invented So, I'm already using sleep to make
my script execute some funcs in a defined interval, but when the time is
0AM-9AM I don't want the delay to be the normal one (randint(5,10) * 60) -
5~10min, I want it to be like 2hours.

The script will be running 24/7, but from 0AM to 9AM it will slowdown a
bit.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: smptplib problem SMTPRecipientsRefused for emails with ! exclamation mark in local portion of email

2014-12-17 Thread Chris Angelico
On Thu, Dec 18, 2014 at 7:59 AM, Michael Ströder mich...@stroeder.com wrote:
 You should really think about why these chars were excluded in the
 configuration: The reason is that those they are special in shells.

 And many SMTP deployments have pretty naive (shell) scripts or software with
 shell exits. So allowing those chars can cause more or less big security
 risks. For this reason it's likely that you will end in spam filters / black
 lists etc. because systems may assume you want to do some harm.

 So I would really rethink the requirements.

 Your mileage may vary. But you have been warned.

It's worth noting that the SMTP spec never says that every server must
accept all characters. I could create a perfectly compliant mail
server in which recipient names may not include the letter 'e', for
instance. It would be a bug if smtplib rejected those, but since the
rejection is coming from the server, that's fairly legit.

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Chris Cioffi
Hi Juan,

I don't know what platform you're on, but you've got several options.  

Mac:  setup a launchd job, I use http://www.soma-zone.com/LaunchControl/ to do 
the setups

Linux/unix:  setup a cron job, depending on your distro launchd may also be an 
option.

Windows:  setup a scheduled job in ??  (I don't have a windows box around any 
more, but there was a Scheduled Jobs section in windows explorer back in the 
XP days.  I assume it's still around.

In all cases, you'll need to add a little code in your script to STOP at 11:59, 
but the OS can handle starting the script.

The launchd option can also act as a watchdog to also restart the script if it 
fails for some reason.

Hope this helps!


 On Dec 17, 2014, at 2:11 PM, Juan Christian juan0christ...@gmail.com wrote:
 
 Ops, sorry.
 
 It's: 9:00 AM ~ 11:59 PM - Running
 
 ... and not 9:00 AM ~ 11:50 PM - Running
 -- 
 https://mail.python.org/mailman/listinfo/python-list

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Steven D'Aprano
Juan Christian wrote:

 I know about the schedule modules and such but they work in situations
 like 'run this in a X hours/minutes/seconds interval', I already have my
 code in a while loop with sleep (it's a bit ugly, I'l change to a
 scheduler soon).
[...] 
 I want my script to start at a given time and stop at another given time,
 is that possible?

The right solution to this is probably to use your operating system's
scheduler to run your script at whatever time or times you want. Under
Unix/Linux, that is cron. I'm sure Windows will have it's own, but I don't
know what it is.

Then your script then doesn't have to care about times at all, it just runs
and does its thing, and the OS controls when it runs. cron is amazingly
flexible.

This is the proper separation of concerns. Your script doesn't have to deal
with memory management, or the file system, or scheduling times, that is
the operating system's job. The OS already has tools to do this, and can do
them *much better than you*. (What happens if your script dies? What about
when the time changes, say because of daylight savings?)

Unless you are running on some primitive OS with no way to control when jobs
run except to manually run them, the *wrong* solution is a busy-wait loop:

while True:
# Wait forever, doing nothing.
sleep(0.1)  # Yawn.
if now() == some_time():
do_this()


It doesn't matter if you use the sched module to shift the time check to
another part of your code if the main loop does nothing. The critical
question here is this:

While you are waiting for the scheduled time, does your main loop
continuously do any other work? 

If the answer is Yes, then using sched is the right approach.

If the answer is No, then your main loop is just killing time, doing nothing
but sleeping and waiting, like somebody checking their wristwatch every two
seconds. You should simplify your script by getting rid of the main loop
completely and let your OS handle the timing:

# No loop at all.
do_this()


-- 
Steven

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


Please help - Python role in Emeryville, CA - Full-time - $100K+

2014-12-17 Thread Jared E. Cardon
Hi,

I found your Python group on Google+ and I'm searching for someone with 3+ 
years of Python development experience for a full-time position in California.  
Salary north of $100K and working for an amazing company.  Ideally I'd like to 
find someone who is nice, plugged into the movie and comic culture, and very 
skilled at python and web application development.

If you know of anyone local to the area who would be interested please put me 
in touch with them.  Feel free to post my request on the group page.

Thank you,
Jared


Jared Cardon
Account Manager
Phone: (415) 635-3764 | Cell: (646) 287-7738 | 
jcar...@sisinc.commailto:jcar...@sisinc.com | 
www.sisinc.comhttp://www.sisinc.com/

Systems Integration Solutions - A Diversity Vendor
Proud to be in our 25th year of providing IT Consulting resources and services
[cid:image004.jpg@01D01A13.ABA62E80]http://www.linkedin.com/in/jaredcardon/[Description:
 cid:image008.jpg@01CDD3B3.D1FF2B20]http://sisinc.com/job-central

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


Re: Is there a way to schedule my script?

2014-12-17 Thread Juan Christian
On Wed Dec 17 2014 at 9:40:52 PM Steven D'Aprano 
steve+comp.lang.pyt...@pearwood.info wrote:

 Juan Christian wrote:

  I know about the schedule modules and such but they work in situations
  like 'run this in a X hours/minutes/seconds interval', I already have my
  code in a while loop with sleep (it's a bit ugly, I'l change to a
  scheduler soon).
 [...]
  I want my script to start at a given time and stop at another given time,
  is that possible?

 The right solution to this is probably to use your operating system's
 scheduler to run your script at whatever time or times you want. Under
 Unix/Linux, that is cron. I'm sure Windows will have it's own, but I don't
 know what it is.

 Then your script then doesn't have to care about times at all, it just runs
 and does its thing, and the OS controls when it runs. cron is amazingly
 flexible.

 This is the proper separation of concerns. Your script doesn't have to deal
 with memory management, or the file system, or scheduling times, that is
 the operating system's job. The OS already has tools to do this, and can do
 them *much better than you*. (What happens if your script dies? What about
 when the time changes, say because of daylight savings?)

 Unless you are running on some primitive OS with no way to control when
 jobs
 run except to manually run them, the *wrong* solution is a busy-wait loop:

 while True:
 # Wait forever, doing nothing.
 sleep(0.1)  # Yawn.
 if now() == some_time():
 do_this()


 It doesn't matter if you use the sched module to shift the time check to
 another part of your code if the main loop does nothing. The critical
 question here is this:

 While you are waiting for the scheduled time, does your main loop
 continuously do any other work?

 If the answer is Yes, then using sched is the right approach.

 If the answer is No, then your main loop is just killing time, doing
 nothing
 but sleeping and waiting, like somebody checking their wristwatch every two
 seconds. You should simplify your script by getting rid of the main loop
 completely and let your OS handle the timing:

 # No loop at all.
 do_this()


Thanks. That was a great answer. I'll redo my code. It's running and will
only run in my Docker container (Ubuntu Server 14.04.1) so I'll use cron.

Indeed, currently I'm using something like that:

while True:
if 9  datetime.now().hour  24:
# do stuff
sleep(randint(3, 6) * 60)
else:
# see you in 9 hours
sleep(9 * 60 * 60)

I knew it wasn't a good approach, but as least it was running as intended!
-- 
https://mail.python.org/mailman/listinfo/python-list


Python gethostbyname fails just one one machine.

2014-12-17 Thread abhishes
I have many machines on which the following command returns nothing (but does 
not throw an error as well

python -c 'import socket; socket.gethostbyname(socket.getfqdn())'


but on just one machine. this command throws

Traceback (most recent call last):
  File string, line 1, in module
socket.gaierror: [Errno -3] Temporary failure in name resolution


I searched the internet and most people had this problem because of a bad 
/etc/hosts file or /etc/sysconfig/network file

but in my case this files are absolutely correct

/etc/hosts
127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
156.17.148.40 cm1work
156.17.148.41 hd1work
156.17.148.42 hd2work
156.17.148.43 hd3work

/etc/sysconfig/network
NETWORKING=yes
HOSTNAME=h3work
GATEWAY=156.17.148.1

but this command just won't work

Please help me out.
~
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python gethostbyname fails just one one machine.

2014-12-17 Thread Chris Angelico
On Thu, Dec 18, 2014 at 2:21 PM,  abhis...@gmail.com wrote:
 I have many machines on which the following command returns nothing (but does 
 not throw an error as well

 python -c 'import socket; socket.gethostbyname(socket.getfqdn())'


 but on just one machine. this command throws

 Traceback (most recent call last):
   File string, line 1, in module
 socket.gaierror: [Errno -3] Temporary failure in name resolution


 I searched the internet and most people had this problem because of a bad 
 /etc/hosts file or /etc/sysconfig/network file

 but in my case this files are absolutely correct

 /etc/hosts
 127.0.0.1   localhost localhost.localdomain localhost4 localhost4.localdomain4
 ::1 localhost localhost.localdomain localhost6 localhost6.localdomain6
 156.17.148.40 cm1work
 156.17.148.41 hd1work
 156.17.148.42 hd2work
 156.17.148.43 hd3work

 /etc/sysconfig/network
 NETWORKING=yes
 HOSTNAME=h3work
 GATEWAY=156.17.148.1

 but this command just won't work

What you have here is a networking issue, not a Python one, so you may
well find you can't get the help you need here. But I'll try.

Have you checked /etc/nsswitch.conf? What about /etc/resolv.conf or
equivalent? What's the FQDN returned in the first step? If there's a
difference in any of those, it might give a clue.

If all else fails, try stracing the process:

strace python -c 'import socket; socket.gethostbyname(socket.getfqdn())'

and see if there are any obvious errors.

This is a bit of nutting out and analysis, so I wouldn't be surprised
if you get lots of wrong answers before you find the right one. It's
like Edison said (or is said to have said): you're finding a thousand
ways to NOT make a light bulb.

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


Re: Python gethostbyname fails just one one machine.

2014-12-17 Thread Abhishek Srivastava
I was able to resolve the issue.

since you said that there is nothing wrong with python as such... and its a 
networking issue.

I deleted the network adapter of my vm and then re-created it.

now suddenly it began to work. funny!
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python gethostbyname fails just one one machine.

2014-12-17 Thread Chris Angelico
On Thu, Dec 18, 2014 at 3:26 PM, Abhishek Srivastava abhis...@gmail.com wrote:
 I was able to resolve the issue.

 since you said that there is nothing wrong with python as such... and its a 
 networking issue.

 I deleted the network adapter of my vm and then re-created it.

 now suddenly it began to work. funny!

Huh. Well, could have been some sort of weird configuration issue, who
knows. Glad it's working now, anyway!

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


Re: Classes - delegation question.

2014-12-17 Thread dieter
Ivan Evstegneev webmailgro...@gmail.com writes:
 I have a question about delegation coding pattern(I'm working with Python
 3.4).

Unlike Java, Python supports multiple inheritance. This means
that you need delegation much more rarely in Python.
Python does not have much special support for delegation: usually,
you must delegate explicitely - maybe using a delagating decorator.

 ...
 When code looks like in  Case 1, it actually works with standard
 inheritance model. (with sub and super-class definitions).
 Also according to the book:
 ***
 This code leverages the fact that a class's method can always be called
 either through
 an instance (the usual way, where Python sends the instance to the self
 argument
 automatically) or through the class (the less common scheme, where you must
 pass the
 instance manually). In more symbolic terms, recall that a normal method call
 of this
 form:
   instance.method(args...)
 is automatically translated by Python into this equivalent form:
   class.method(instance, args...)
  ***

 Furthermore:

 ***
 Python provides it automatically only for calls made through an instance.
 For calls 
 through the class name, you need to send an instance to self yourself; for
 code inside 
 a method like giveRaise, self already is the subject of the call, and hence
 the instance 
 to pass along.
 Calling through the class directly effectively subverts inheritance and
 kicks the call
 higher up the class tree to run a specific version.
 

 What is considered as a call in this context?

Something of the form expression(args...). I.e. any call of
a function or method.

The discussion above does not directly apply to your situation.
It targets more specifically the following case:

   class Base:
 ...
 def f(self, ...):
   ...

   class Derived(Base):
 ...
 def f(self, ...):
   ...
   Base.f(self, ...)
   ...

i.e., you have two classes Base, and Derived where
Derived overrides the inherited f and its definition
involves the use of the inherited f. Inside the redefinition,
you must make explicit that you mean the inherited f and not
the f being defined. In those cases, you typically use
the pattern Base.f, meaning the f defined in Base.
However, you may use the form anywhere - its just rarer in other
cases.

It you use instance.f, then instance is automatically
passed as first argument to f; however, it you use
class.f, then nothing is passed on automatically as first
parameter. When class.f is finally called, you usually need
to pass an instance of class as first parameter explicitely.


 Is it a code inside class method?

Usually, you use class.f inside the redefinition of f
in a derived class. But, you can use it anywhere (if you like).

 For instance(relates to the Case 1):

 def giveRaise(self, percent, bonus = .10):
   Person.giveRaise(self, percent + bonus)

 The call will be : Person.giveRaise(self, percent + bonus)   ?

Yes.

 In such a case, when I create an instance:

 tom = Manager('Tom Jones', 5)

 and then invoke giveRaise method 

 tom.giveRaise(.10)

 I essentially say this:

 class.method(instance, args...) 

 Where class is Person and method is giveRaise and instance is tom?

Yes.

 Moreover, because of how it defined (a method giveRaise), I make a call
 through the class name?

Loosely speaking, yes.

 What is the call through instance? 

Your tom.giveRaise. There tom is a Manager instance.

 Is it this one(according to Case 1):

 class Person:
   ...
   def giveRaise(self, percent):
   self.pay = int(sel.pay * (1 + percent))
   ...

 and then:

 bob = Person('Bob Smith', 'dev', 3)
 bob.giveRaise(.10) Is this call through instance? 

Yes.


 ...
 Questions regard to Case 2 example:

 class Person: 
   the same...

 class Manager: 
   def __init__(self, name, pay):
   self.person = Person(name, 'mgr', pay)   ---
 Initialization of Manager's attribute named  'self.person and embedding  a
 Person object. 
   
   def giveRaise(self, percent, bonus = .10): --
 Defenition of Manager's method named giveRaise and according to the book:
   self.person.giveRaise(percent + bonus)   Intercept and
 delegate
   ..

 My question here is substantially the same:

 On the one hand we embedding Person into Manager class, 

 On the other hand, when I write this code:

 tom = Manager('Tom Jones', 5000)

 I create an instance of Manager that have an attribute named: tom.person,
 which in turn is a class named Person.

... is an instance of a class ...


 And when typing:

tom.giveRaise(.10)

 I do kinda same thing. 

Indeed -- just a bit more convoluted in 

[issue22706] Idle extension configuration and key bindings

2014-12-17 Thread Saimadhav Heblikar

Saimadhav Heblikar added the comment:

ZoomHeight behavior on linux is as what you mentioned. Now I have understood 
this issue. Working on it.

--

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



[issue15513] Correct __sizeof__ support for pickle

2014-12-17 Thread Serhiy Storchaka

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


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue19548] 'codecs' module docs improvements

2014-12-17 Thread Serhiy Storchaka

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


--
stage:  - needs patch
type:  - enhancement
versions: +Python 2.7, Python 3.5 -Python 3.3

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Perhaps an API like importlib.util.locks_held() that returns a list of module 
names?

We'd then just iterate over the _module_locks() dictionary, looking for locks 
where the owner matched the current thread id (alternatively, if speed was 
critical for Guido's use case, add a separate reverse mapping from tid to locks 
held)

(Unless I've missed something, we don't run user code with the global import 
lock held any more)

--

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



[issue20121] quopri_codec newline handling

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

RFC 1521 says that a text newline should be encoded as CRLF, and that any 
combination of 0x0D and 0x0A bytes that do not represent newlines should be 
encoded like other control characters as =0D and =0A.

Since in Python 3 the codec outputs bytes, I don’t think there is any excuse 
for it to be outputting plain CR or LF bytes. The question is, do they 
represent newlines to be encoded as CRLF, or just data bytes that need ordinary 
encoding.

--
nosy: +vadmium
versions: +Python 3.4

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



[issue22038] Implement atomic operations on non-x86 platforms

2014-12-17 Thread Gustavo Frederico Temple Pedrosa

Gustavo Frederico Temple Pedrosa added the comment:

ping

--
nosy: +gustavotemple

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



[issue20121] quopri_codec newline handling

2014-12-17 Thread Marc-Andre Lemburg

Marc-Andre Lemburg added the comment:

I agree with Vajrasky: a patch for the documentation would probably be a good 
idea.

Note that mixing line end conventions in a single text is never a good idea. If 
you stick to one line end convention, there's no problem with the codec, AFAICT.

 codecs.encode(b'\r\n\r\n', 'quopri_codec')
b'\r\n\r\n'
 codecs.decode(_, 'quopri_codec')
b'\r\n\r\n'
 codecs.encode(b'\n\n', 'quopri_codec')
b'\n\n'
 codecs.decode(_, 'quopri_codec')
b'\n\n'

--
nosy: +lemburg

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



[issue22919] Update PCBuild for VS 2015

2014-12-17 Thread Trent Nelson

Changes by Trent Nelson tr...@snakebite.org:


--
nosy: +trent

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



[issue23070] Error in Tutorial comment

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 81c73f964066 by Berker Peksag in branch '3.4':
Issue #23070: Fix a comment in the tutorial.
https://hg.python.org/cpython/rev/81c73f964066

New changeset 81e2f58d9e4b by Berker Peksag in branch 'default':
Issue #23070: Fix a comment in the tutorial.
https://hg.python.org/cpython/rev/81e2f58d9e4b

--
nosy: +python-dev

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



[issue23070] Error in Tutorial comment

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 8cd84e62c1fd by Berker Peksag in branch '2.7':
Issue #23070: Fix a comment in the tutorial.
https://hg.python.org/cpython/rev/8cd84e62c1fd

--

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



[issue23070] Error in Tutorial comment

2014-12-17 Thread Berker Peksag

Berker Peksag added the comment:

Fixed. Thanks for the report, Ross.

--
nosy: +berker.peksag
resolution:  - fixed
stage:  - resolved
status: open - closed
type:  - behavior
versions: +Python 2.7, Python 3.5

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



[issue22733] MSVC ffi_prep_args doesn't handle 64-bit arguments properly

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 4c81b1846e14 by Steve Dower in branch 'default':
Issue #22733: MSVC ffi_prep_args doesn't handle 64-bit arguments properly
https://hg.python.org/cpython/rev/4c81b1846e14

--
nosy: +python-dev

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Eric Snow

Eric Snow added the comment:

 (Unless I've missed something, we don't run user code with the global
import lock held any more)

Ah.  You are correct.

--

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



[issue22733] MSVC ffi_prep_args doesn't handle 64-bit arguments properly

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 24f4569a1308 by Steve Dower in branch 'default':
Issue #22733: Added NEWS item
https://hg.python.org/cpython/rev/24f4569a1308

--

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



[issue23060] Assert fails in multiprocessing.heap.Arena.__setstate__ on Windows

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset 1794d754ff3c by Steve Dower in branch 'default':
Issue #23060: Suppresses a multiprocessing assert that fails incorrectly
https://hg.python.org/cpython/rev/1794d754ff3c

--
nosy: +python-dev

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



[issue22733] MSVC ffi_prep_args doesn't handle 64-bit arguments properly

2014-12-17 Thread Steve Dower

Changes by Steve Dower steve.do...@microsoft.com:


--
resolution:  - fixed
stage: patch review - resolved
status: open - closed

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



[issue23060] Assert fails in multiprocessing.heap.Arena.__setstate__ on Windows

2014-12-17 Thread Steve Dower

Steve Dower added the comment:

I've commented out the assertion for now with a comment pointing to this issue, 
so that'll keep the buildbots running while we figure out how to deal with this 
properly.

--

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



[issue23065] Pyhton27.dll at SysWOW64 not updated when updating Python 2.7.X

2014-12-17 Thread Steve Dower

Steve Dower added the comment:

When you say 2.7.X, which version are you installing and which version did 
you have installed?

--

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Guido van Rossum

Guido van Rossum added the comment:

Oh. I'd forgotten the PY3 situation is completely different from the PY2
situation. We're still stuck here in PY2 land where there's just the one
import lock. I guess not even ctypes can help us find out whether the
current thread is holding the import lock (which is the condition we're
trying to test for so we can print the warning). Our current hack is to
check lock_held() and if it is held wait for up to 5 second (in 10 msec
increments) to see if it goes away -- if it doesn't go away it would seem
we are holding it in the current thread and then we fail with a rude
assert. If it does go away within that time we assume some other thread was
doing some lazy importing and we hope they'll be done soon because the
whole world is waiting for them.

On Wed, Dec 17, 2014 at 6:36 AM, Eric Snow rep...@bugs.python.org wrote:


 Eric Snow added the comment:

  (Unless I've missed something, we don't run user code with the global
 import lock held any more)

 Ah.  You are correct.

 --

 ___
 Python tracker rep...@bugs.python.org
 http://bugs.python.org/issue23068
 ___


--

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



[issue16991] Add OrderedDict written in C

2014-12-17 Thread Wes Turner

Wes Turner added the comment:

* Macros could be useful.
* Would this make it easy/faster to also have a DefaultOrderedDict (which 
can/could also be accomplished with .get(attr, []) and .setdefault(attr, [])?
* There may be some value in looking at 
https://pypi.python.org/pypi/cyordereddict
* (I'm really not qualified to review this. Valgrind?)

--
nosy: +westurner

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



[issue20121] quopri_codec newline handling

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Okay so maybe the documentation should include these restrictions on encoding:

* The data being encoded should only include \r or \n bytes that are part of \n 
or \r\n newline sequences. Encoding arbitrary non-text data is not supported.
* The two kinds of newlines should not be mixed
* If \n is used for newlines in the input, the encoder will output \n newlines, 
and they will need converting to CRLF in a later step to conform to the RFC

--

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



[issue20121] quopri_codec newline handling

2014-12-17 Thread Serhiy Storchaka

Serhiy Storchaka added the comment:

Pure Python implementation returns different result.

 import quopri
 quopri.encodestring(b'\r\n')
b'\r\n'
 quopri.a2b_qp = quopri.b2a_qp = None
 quopri.encodestring(b'\r\n')
b'=0D\n'

See also issue18022.

--
nosy: +serhiy.storchaka

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



[issue16991] Add OrderedDict written in C

2014-12-17 Thread Eric Snow

Eric Snow added the comment:

Suggestions from Antoine on python-dev:

* do not make cOrderedDict builtin; drop changes to:
  - Include/Python.h
  - Objects/object.c
  - Makefile.pre.in
* do not add a C-API
* include the linked list pointers in the hash entries? (may simplify things)
* drop the shared/split keys mechanism?
* do not subclass dict? (can of worms)

--

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



[issue23073] Broken turtle example in Cmd documentation

2014-12-17 Thread bbc

New submission from bbc:

The documentation page for the cmd module contains an example with the turtle 
module:

https://docs.python.org/3.4/library/cmd.html#cmd-example

It seems like the turtle module has changed quite a bit since the code was 
written, and exposes a Pen class instead of all the various movement functions. 
 The example, while still useful, cannot be executed as is.

I like the example and would be happy to provide an idiomatic replacement if 
you think this is necessary.

--
assignee: docs@python
components: Documentation
messages: 232829
nosy: bbc, docs@python
priority: normal
severity: normal
status: open
title: Broken turtle example in Cmd documentation
type: behavior
versions: Python 3.4

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



[issue23074] asyncio: get_event_loop() must always raise an exception, even when assertions are disabled by -O

2014-12-17 Thread STINNER Victor

New submission from STINNER Victor:

Spinoff of the issue #22926: asyncio.get_event_loop() must always raise an 
exception, even when assertions are disabled by -O.

Attached patch implements this suggestion.

--
components: asyncio
files: get_event_loop.patch
keywords: patch
messages: 232830
nosy: gvanrossum, haypo, yselivanov
priority: normal
severity: normal
status: open
title: asyncio: get_event_loop() must always raise an exception, even when 
assertions are disabled by -O
versions: Python 3.4, Python 3.5
Added file: http://bugs.python.org/file37482/get_event_loop.patch

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

Looking at the implementation of PyImport_ImportModuleNoBlock, you should be 
able to invoke that via ctypes with a nonsense module name to probe for whether 
or not the current thread has the import lock.

A call like 'PyImport_ImportModuleNoBlock(this-is-not-a-legal-module-name)' 
will always fail with ImportError, but the exception message will be different 
if another thread holds the import lock. Specifically, it will end with 
because the import lock is held by another thread.

--

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Nick Coghlan

Nick Coghlan added the comment:

You'd still need to check lock_held() to see if *some* thread is holding the 
import lock. The non-blocking import API should then let you determine if that 
thread is the current one.

--

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



[issue22926] asyncio: raise an exception when called from the wrong thread

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

Guido So in order to do correct diagnostics here we would have to add an 
owning
thread pointer to every event loop;

I didn't understand why this approach was not taken when the check was 
introduced. I was surprised that get_event_loop() was used for the check 
instead.

Here is a patch checking the thread using threading.get_ident(). The check 
still works when set_event_loop(None) is used in unit tests.

I created the issue #23074 for the change: get_event_loop() must always raise 
an exception, even when assertions are disabled by -O.

--

asyncio requires thread support, it is already the case without my patch. For 
example, the event loop policy uses threading.Local.

In the aioeventlet project, call_soon() writes a byte in the self pipe (to wake 
up the selector) if the selector is waiting for events; call_soon() is green 
thread safe. It is less efficient than calling forcing users to call 
explicitly call_soon_threadsafe(), but aioeventlet is written to be compatible 
with asyncio and eventlet, while these projects are very different.

In the aiogevent and aioeventlet projects, I also store the current greenlet, 
but for a different purpose: ensure that yield_future() is not called in the 
greenlet running the event loop, which would blocking.

--
Added file: http://bugs.python.org/file37483/check_thread.patch

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



[issue23073] Broken turtle example in Cmd documentation

2014-12-17 Thread Ethan Furman

Ethan Furman added the comment:

Please do!  Working examples are better than non-working ones.  :)

--
nosy: +ethan.furman

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



[issue23073] Broken turtle example in Cmd documentation

2014-12-17 Thread Ethan Furman

Ethan Furman added the comment:

While you're at it, could you also sign the contributors' license agreement?

https://www.python.org/psf/contrib/contrib-form/

--

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



[issue22038] Implement atomic operations on non-x86 platforms

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

Fedora 20 provides GCC 4.7 but no stdatomic.c: HAVE_BUILTIN_ATOMIC set 
(HAVE_STD_ATOMIC unset).

Fedora 21 provides GCC 4.9 with stdatomic.c: HAVE_BUILTIN_ATOMIC and 
HAVE_STD_ATOMIC are set.

I tested atomicv2.patch on Fedora 20 (x86_64) and Fedora 21 (x86_64): the whole 
test suite pass.

--

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



[issue23068] Add a way to determine if the current thread has the import lock

2014-12-17 Thread Guido van Rossum

Guido van Rossum added the comment:

Interesting. The Dropbox server team thanks you for the suggestion!

--

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



[issue23075] Mock backport in 2.7 relies on implementation defined behavior

2014-12-17 Thread Alex Gaynor

New submission from Alex Gaynor:

Whether __builtins__ is a module or a dict is undefined in CPython. Use the 
reliably well defined `import __builtin__` instead.

--
components: Library (Lib)
files: mock-backport.diff
keywords: patch
messages: 232838
nosy: alex, benjamin.peterson, dstufft
priority: normal
severity: normal
status: open
title: Mock backport in 2.7 relies on implementation defined behavior
versions: Python 2.7
Added file: http://bugs.python.org/file37484/mock-backport.diff

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



[issue22038] Implement atomic operations on non-x86 platforms

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

atomicv2.patch:
 _Atomic int _value;

Why not using the atomic_int type from stdatomic.h here?

 https://gcc.gnu.org/onlinedocs/gcc/_005f_005fatomic-Builtins.html

__atomic_store_n(): The valid memory model variants are __ATOMIC_RELAXED, 
__ATOMIC_SEQ_CST, and __ATOMIC_RELEASE.

I understand that _Py_atomic_store_explicit() only accept some values for 
order. An assertion should be added here, maybe for any implementation. 
Something like:

#define _Py_atomic_store_explicit(ATOMIC_VAL, NEW_VAL, ORDER) \
(assert((ORDER) == __ATOMIC_RELAXED   \
|| (ORDER) == __ATOMIC_SEQ_CST\
|| (ORDER) == __ATOMIC_RELEASE),  \
 __atomic_store_n((ATOMIC_VAL)-_value, NEW_VAL, ORDER))

Same remark for _Py_atomic_load_explicit():

__atomic_load_n(): The valid memory model variants are __ATOMIC_RELAXED, 
__ATOMIC_SEQ_CST, __ATOMIC_ACQUIRE, and __ATOMIC_CONSUME.

--

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



[issue21071] struct.Struct.format is bytes, but should be str

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

 It would be backwards incompatible to change, though.

I'm in favor of breaking the compatibility with Python 3.4 and return the 
format as an Unicode string.

--
nosy: +haypo

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



[issue21619] Cleaning up a subprocess with a broken pipe

2014-12-17 Thread STINNER Victor

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


--
nosy: +haypo

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



[issue23076] path.glob() fails with IndexError

2014-12-17 Thread Antony Lee

New submission from Antony Lee:

glob.glob returns an empty list when passed an empty pattern as argument, but 
pathlib's Path.glob fails with IndexError.  The first option seems more 
reasonable (or at least it should be a ValueError).

--
components: Library (Lib)
messages: 232841
nosy: Antony.Lee
priority: normal
severity: normal
status: open
title: path.glob() fails with IndexError
versions: Python 3.4

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



[issue23077] PEP 1: Allow Provisional status for PEPs

2014-12-17 Thread Nick Coghlan

New submission from Nick Coghlan:

As per python-dev discussion [1], filing this as the home for a proposed update 
to PEP 1 that allows Standards Track PEPs to be granted Provisional status 
before moving on to Accepted/Final.

The new status will be for PEPs where we want to release an initial reference 
implementation (whether in CPython under PEP 411 or through the PyPA toolchain) 
before locking down the exact details of the API specification.

[1] https://mail.python.org/pipermail/python-dev/2014-December/137622.html

--
assignee: ncoghlan
messages: 232842
nosy: Jeremy.Hylton, barry, goodger, ncoghlan
priority: normal
severity: normal
stage: needs patch
status: open
title: PEP 1: Allow Provisional status for PEPs
type: enhancement

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



[issue21071] struct.Struct.format is bytes, but should be str

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

I originally assumed it would be a text string from the existing documentation, 
so changing the behaviour to match also seems reasonable

--

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



[issue23074] asyncio: get_event_loop() must always raise an exception, even when assertions are disabled by -O

2014-12-17 Thread Roundup Robot

Roundup Robot added the comment:

New changeset b4dce0e695df by Victor Stinner in branch '3.4':
Issue #23074: asyncio.get_event_loop() now raises an exception if the thread
https://hg.python.org/cpython/rev/b4dce0e695df

--
nosy: +python-dev

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



[issue23074] asyncio: get_event_loop() must always raise an exception, even when assertions are disabled by -O

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

Change applied to Python 3.4, 3.5 and Tulip (c6115bc83acc).

Thanks for the review Guido.

--
resolution:  - fixed
status: open - closed

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



[issue23074] asyncio: get_event_loop() must always raise an exception, even when assertions are disabled by -O

2014-12-17 Thread STINNER Victor

STINNER Victor added the comment:

I also updated aiotest test suite:
https://bitbucket.org/haypo/aiotest/commits/d6f544a16a8f55729268d8d4b8d864d1b0af2d12

--

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



[issue23073] Broken turtle example in Cmd documentation

2014-12-17 Thread bbc

bbc added the comment:

It turns out the script is fine.  I could have investigated it more thoroughly 
at first if I had more carefully read the docs for turtle.

I thought those functions were not exposed because they were reportedly not 
found after I copy-pasted, executed the example script and entered commands.  
The reason was my file was named turtle.py.

Sorry for the noise.

--

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



[issue23073] Broken turtle example in Cmd documentation

2014-12-17 Thread Ethan Furman

Ethan Furman added the comment:

No worries, thanks for following up.

--
resolution:  - not a bug
stage:  - resolved
status: open - closed

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



[issue19548] 'codecs' module docs improvements

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Here is a patch addressing many of the points raised. Please have a look and 
give any feedback. Beware I am not very familiar with the Restructured Text 
markup and haven’t tried compiling it.

1. Mentioned bytes-to-bytes and text-to-text in general right at the top. Any 
APIs (e.g. see Issue 20132) that don't support them should be pointed out as 
exceptions to the rule.

8. The underlying mode is forced to binary, so 'r' is the same as 'rb'. I 
removed the 'b' from the signature for clarity.

## Jan’s points not yet addressed: ##

3. I expect the built-in open() function would already be much more obvious and 
advertised, so I didn't add any cross-reference from codecs.open().

5. Both points still need addressing:
  * Lack of requirement for implementing incremental codecs
  * Responsibility of implementing error handlers

9. First point left unaddressed:
  * register_error() error_handler replacement data type (unsure of details)

## Numbering Nick’s points: ##

12. Codec name normalization: Not addressed; what should be written?

[13. Registration not reversible: Added in patch]

[14. Added CodecInfo class, pulling out some existing details from register().]

15. “encodings” module: not done

16. Import system: not done

## My (Martin’s) point: ##

[17. IncrementalEncoder.reset(): done]

## Zoinkity’s points, not addressed: ##

18. Multibyte codecs

19. register() usage example

## Some new points of my own that need fixing: ##

20. The doc string for register() says the search function is also allowed to 
return a tuple of functions, but the reference manual does not mention this. 
Which is more accurate? (I notice CodecInfo is a subclass of “tuple”.)

21. EncodedFile() seems to return StreamRecoder instances. Perhaps move them 
closer together? Should probably warn that EncodedFile's data_encoding is 
handled by a stateless codec.

22. The Codec.encode() and decode() methods return a length consumed, but I 
suspect they have to consume everything they are supplied because the code I 
have seen ignores this return value.

--
keywords: +patch
Added file: http://bugs.python.org/file37485/codecs-doc.patch

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



[issue20132] Many incremental codecs don’t handle fragmented data

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

The “unicode-escape” and “utf-7” cases affect the more widely-used 
TextIOWrapper interface:

 TextIOWrapper(BytesIO(br\u2013 * 2000), unicode-escape).read(1)
Traceback (most recent call last):
  File stdin, line 1, in module
  File /usr/lib/python3.4/encodings/unicode_escape.py, line 26, in decode
return codecs.unicode_escape_decode(input, self.errors)[0]
UnicodeDecodeError: 'unicodeescape' codec can't decode bytes in position 
8190-8191: truncated \u escape
 w = TextIOWrapper(BytesIO(), utf-7)
 w.writelines(\xA9\xA9)  # Write one character at a time
 w.detach().getvalue()
b'+AKk-+AKk-'
 r = TextIOWrapper(BytesIO(b+ + b * 10 + b-), utf-7)
 r.read(1)  # Short delay as all 800 kB are decoded to read one character
'\x00'
 r.buffer.tell()
82

For UTF-7 decoding to work optimally I think the amount of data buffering 
necessary would be limited to only a few bytes.

--

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



[issue19539] The 'raw_unicode_escape' codec buggy + not appropriate for Python 3.x

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

I included the proposed doc fix in my patch for Issue 19548

--
nosy: +vadmium

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



[issue19548] 'codecs' module docs improvements

2014-12-17 Thread Berker Peksag

Changes by Berker Peksag berker.pek...@gmail.com:


--
nosy: +berker.peksag
stage: needs patch - patch review

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



[issue23071] codecs.__all__ incomplete

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Here is the patch (against the default branch)

--
keywords: +patch
Added file: http://bugs.python.org/file37486/codecs-all.patch

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



[issue23062] test_argparse --version test cases

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Patch looks sensible enough to me

--

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



[issue23071] codecs.__all__ incomplete

2014-12-17 Thread Berker Peksag

Berker Peksag added the comment:

Thanks! Could you also add a test? See PublicAPITests in 
Lib/test/test_shutil.py as an example.

--
stage: needs patch - patch review

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



[issue21279] str.translate documentation incomplete

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Here is a new patch based on John’s suggestion

--
Added file: http://bugs.python.org/file37487/issue21279.patch

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



[issue23076] path.glob() fails with IndexError

2014-12-17 Thread liu chang

liu chang added the comment:

In[6]: pathlib.Path.glob()
Traceback (most recent call last):
  File 
/home/liuchang/ENV3/lib/python3.4/site-packages/IPython/core/interactiveshell.py,
 line 2883, in run_code
exec(code_obj, self.user_global_ns, self.user_ns)
  File ipython-input-6-a6dcf250fe73, line 1, in module
pathlib.Path.glob()
TypeError: glob() missing 1 required positional argument: 'pattern'

the version of my python is 3.4。
I got a TypeError, No IndexError。

--
nosy: +liu chang

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



[issue21071] struct.Struct.format is bytes, but should be str

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Here is a patch that changes over to a str() type.

Is it safe to assume PyUnicode_AsUTF8() is null-terminated (like 
PyBytes_AS_STRING() is)? My documentation doesn’t say.

--
Added file: http://bugs.python.org/file37488/format-str.patch

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



[issue16349] Document whether it's safe to use bytes for struct format string

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Assuming it is intended to support byte strings, here is a patch that documents 
them being allowed, and adds a test case

--
keywords: +patch
Added file: http://bugs.python.org/file37489/format-bytes.patch

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



[issue23065] Pyhton27.dll at SysWOW64 not updated when updating Python 2.7.X

2014-12-17 Thread GamesGamble

GamesGamble added the comment:

2.7.7 was installed and I has installed 2.7.8 and 2.7.8 was installed and then 
I has installed 2.7.9.

--

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



[issue19176] DeprecationWarning for doctype() method when subclassing _elementtree.XMLParser

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

Here is another patch that removes the method instead, as suggested in the 
review

--
Added file: http://bugs.python.org/file37490/doctype-remove.patch

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



[issue23071] codecs.__all__ incomplete

2014-12-17 Thread Martin Panter

Martin Panter added the comment:

This patch includes a new test; although this kind of testing won’t detect when 
someone adds a new API and forgets to add it to __all__.

--
Added file: http://bugs.python.org/file37491/codecs-all.patch

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



[issue19176] DeprecationWarning for doctype() method when subclassing _elementtree.XMLParser

2014-12-17 Thread Arfrever Frehtes Taifersar Arahesis

Arfrever Frehtes Taifersar Arahesis added the comment:

doctype-remove.patch is acceptable for both 3.4 and 3.5 or only 3.5?
If only 3.5, then please apply inherit-doctype.patch in 3.4.

--

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