[This announcement is in German since it targets a local user group
meeting in Düsseldorf, Germany]
ANKÜNDIGUNG
Python Meeting Düsseldorf
http://pyddf.de/
Ein Treffen
I am pleased to announce version 3.14.0 of the Python bindings for
GObject Introspection. This is the first stable release in the 3.14 series.
This major release includes refactoring, bug-fixes, performance improvements,
and a few API additions. Thanks to all the contributors and a special
I am happy to announce the release of xlwings v0.2.2:
- Errors on Mac are now shown in a Messsage Box
- The Range class features now an autofit method
and much more, see the Release Notes here:
http://docs.xlwings.org/whatsnew.html
About xlwings:
xlwings is a BSD-licensed python library that
alextr...@googlemail.com wrote:
So I got the Labnol Google Appengine proxy but it can't handle the Post
method aka error 405.
I need help adding this method to the script:
mirror.py = http://pastebin.com/2zRsdi3U
transform_content.py = http://pastebin.com/Fw7FCncA
main.html =
Hello,
Right now, i install python2.7.3 from source code, but when use it to run
some script. It raises no module exception.
Dose `make` not compile array into builtin?
--
Best
Li Tianqing--
https://mail.python.org/mailman/listinfo/python-list
I am sorry, i do not install, i just make, and then use the python under
source code. If you run 'make install' then some lib will compile and then
will no problem there.
Hello,
Right now, i install python2.7.3 from source code, but when use it to run
some script. It raises no module
not quite sure what you mean.. python uses 'list' instead of the C/C++ array
data type. there are __builtin__ and builtins module in 2.7 and 3.2 and a
'array' module. make install, copies files into the system dir-tree but you can
run the interpreter from the build-dir and it should work.
--
jayte wrote:
On Tue, 16 Sep 2014 13:22:02 +0200, Peter Otten __pete...@web.de wrote:
jayte wrote:
On Mon, 15 Sep 2014 09:29:02 +0200, Peter Otten __pete...@web.de
wrote:
[...]
but you can read raw data
with numpy. Something like
with open(filename, rb) as f:
a = numpy.fromfile(f,
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
For example gcd(3, -7) returns -1, which means that a co-prime test that
would work in many other languages 'if gcd(x, y) == 1' will fail in
Python for negative y.
And, of course, since -|x| is less
I use PIL Image.open()
but it show 'list' object has no attribute 'open'
this is my code
class Image2():
trans = connection.begin()
session = Session()
ProductId =
session.query(ProductEntity.ProductId).filter(ProductEntity.CompanyId==2).all()
Image =
On Tue, Sep 23, 2014 at 6:29 PM, Frank Liou fk2654159...@gmail.com wrote:
I use PIL Image.open()
but it show 'list' object has no attribute 'open'
this is my code
class Image2():
trans = connection.begin()
session = Session()
ProductId =
Hello everyone!
I created some code recently to parse a string and create a timedelta from it.
Right now it only accepts positive integers, and only hours, minutes and
seconds, but I think it could be easily extended to support everything that
timedelta accepts.
time_delta_regex =
[This announcement is in German since it targets a local user group
meeting in Düsseldorf, Germany]
ANKÜNDIGUNG
Python Meeting Düsseldorf
http://pyddf.de/
Ein Treffen
On 9/23/14 4:29 AM, Frank Liou wrote:
I use PIL Image.open()
but it show 'list' object has no attribute 'open'
this is my code
class Image2():
trans = connection.begin()
session = Session()
ProductId =
LJ wrote:
I have a network in which the nodes are defined as dictionaries using the
NetworkX package. Inside each node (each dictionary) I defined a
dictionary of dictionaries holding attributes corresponding to different
ways in which the node can be reached (this dictionaries I refer to as
On 09/23/2014 10:16 AM, blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
I guess it is implemented this way because its main use is in the
Fraction constructor.
For example gcd(3, -7) returns -1, which means that a co-prime
Greetings,
Before I start writing my own. Is there something like collections.Counter
(fore frequencies) that does fuzzy matching?
Meaning x is considered equal to y if abs(x - y) epsilon. (x, y and my case
will be numpy.array).
Thanks,
--
Miki
--
On 23/09/2014 12:53, Wolfgang Maier wrote:
On 09/23/2014 10:16 AM, blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
I guess it is implemented this way because its main use is in the
Fraction constructor.
This is not
blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
Good question.
Normally, gcd is only defined for non-negative integers. Wolfram Mathworld,
for example, doesn't mention negative values at all (as far as I can see):
Miki Tebeka wrote:
Before I start writing my own. Is there something like collections.Counter
(fore frequencies) that does fuzzy matching?
Meaning x is considered equal to y if abs(x - y) epsilon. (x, y and my
case will be numpy.array).
The problem I see with that description is that for
On 2014-09-23 05:34, Miki Tebeka wrote:
Before I start writing my own. Is there something like
collections.Counter (fore frequencies) that does fuzzy matching?
Meaning x is considered equal to y if abs(x - y) epsilon. (x, y
and my case will be numpy.array).
Not that I know of -- the
Hello all,
I developed a multithreaded tcp server with python and I converted into a
windows executable using pyinstaller.
I would like to run the server as a windows service so that server restarts
whenever pc restarts without
doing it manually . Help me out with some sample code .
x={'f1':1,'f2':2,'f3':3}
how can i create the following html file automatically with python to
display x ?
table border=1
tr
td
f1
/td
td
f2
/td
td
f3
/td
/tr
td
1
/td
td
2
/td
td
3
/td
tr
/tr
/table
--
https://mail.python.org/mailman/listinfo/python-list
On 23/09/2014 13:50, Steven D'Aprano wrote:
blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
Good question.
Normally, gcd is only defined for non-negative integers. Wolfram Mathworld,
for example, doesn't mention
On Wed, Sep 24, 2014 at 12:37 AM, blindanagram no...@nowhere.net wrote:
That's an argument for a private gcd within the fractions module and a a
'normal' version in math.
Steven's examples show that there's not really much definition of
normal as regards GCD of negative numbers.
ChrisA
--
On Tue, Sep 23, 2014 at 10:18 AM, luofeiyu elearn2...@gmail.com wrote:
x={'f1':1,'f2':2,'f3':3}
how can i create the following html file automatically with python to
display x ?
Generally, you would use a framework like django or others, but you
can make your html a string and use format:
html
I have a certain calculation which can be performed two radically different
ways. With the first algorithm, let's call it SHORT, performance is very
fast for small values of the argument, but terrible for large values. For
the second algorithm, LARGE, performance is quite poor for small values,
On Mon, Sep 22, 2014 at 6:55 PM, Chris Angelico ros...@gmail.com wrote:
Lua is a much simpler language than ECMAScript, incredibly
light-weight, and easily sandboxed. It doesn't work with Unicode (I
think its string type is eight-bit, so you have to work with encoded
bytes), which is a serious
On Wed, Sep 24, 2014 at 12:48 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
On Mon, Sep 22, 2014 at 6:55 PM, Chris Angelico ros...@gmail.com wrote:
Lua is a much simpler language than ECMAScript, incredibly
light-weight, and easily sandboxed. It doesn't work with Unicode (I
think its string type
On Wed, Sep 24, 2014 at 12:48 AM, Steven D'Aprano
steve+comp.lang.pyt...@pearwood.info wrote:
(3) SHORT starts off relatively speedy, significantly faster than LARGE for
the first few tens of thousands of loops. I'm not talking about trivial
micro-optimizations here, I'm talking about the
Add a timing harness and use a test interval (N) and call LARGE every
Nth loop until LARGE's timing is better than the prior SHORT's run.
Emile
On 09/23/2014 07:48 AM, Steven D'Aprano wrote:
I have a certain calculation which can be performed two radically different
ways. With the first
On 2014-09-23 15:48, Steven D'Aprano wrote:
I have a certain calculation which can be performed two radically different
ways. With the first algorithm, let's call it SHORT, performance is very
fast for small values of the argument, but terrible for large values. For
the second algorithm, LARGE,
On Tue, 23 Sep 2014 05:34:19 -0700 (PDT)
Miki Tebeka miki.teb...@gmail.com wrote:
Greetings,
Before I start writing my own. Is there something like collections.Counter
(fore frequencies) that does fuzzy matching?
Meaning x is considered equal to y if abs(x - y) epsilon. (x, y and my
On 09/23/2014 02:50 PM, Steven D'Aprano wrote:
Normally, gcd is only defined for non-negative integers. Wolfram Mathworld,
for example, doesn't mention negative values at all (as far as I can see):
http://mathworld.wolfram.com/GreatestCommonDivisor.html
although buried deep in the
On Tue, Sep 23, 2014 at 4:11 AM, feli...@gmail.com wrote:
I created some code recently to parse a string and create a timedelta from
it.
Interesting. I notice that dateutil.parser.parse already understands you
notation:
x = dateutil.parser.parse(5h32m15s)
x
datetime.datetime(2014, 9, 23,
On Wed, Sep 24, 2014 at 2:32 AM, Rob Gaddi
rgaddi@technologyhighland.invalid wrote:
You'll probably have to write that yourself. While you're at it, think
long and hard about that definition of fuzziness. If you can make it
closer to the concept of histogram bins you'll get much better
On 09/23/2014 07:18 AM, luofeiyu wrote:
x={'f1':1,'f2':2,'f3':3}
how can i create the following html file automatically with python to display x
?
table border=1
tr
td
f1
/td
td
f2
/td
td
f3
/td
/tr
td
1
/td
td
2
/td
td
3
/td
tr
/tr
/table
def tablefy(values):
print tr
for
On Tue, Sep 23, 2014 at 6:39 PM, Skip Montanaro s...@pobox.com wrote:
On Tue, Sep 23, 2014 at 4:11 AM, feli...@gmail.com wrote:
I created some code recently to parse a string and create a timedelta
from it.
Interesting. I notice that dateutil.parser.parse already understands you
On Tue, Sep 23, 2014 at 10:38 AM, Wolfgang Maier
wolfgang.ma...@biologie.uni-freiburg.de wrote:
Maybe fractions.gcd could be renamed, but be wrapped or reimplemented
correctly somewhere else in the stdlib or even in fractions ?
+1
I don't think the math module as suggested upthread is the
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and renaming fractions.gcd to fractions._gcd may be a good idea.
Making a public API private is
In mailman.14262.1411481932.18130.python-l...@python.org luofeiyu
elearn2...@gmail.com writes:
x={'f1':1,'f2':2,'f3':3}
how can i create the following html file automatically with python to
display x ?
You might want to use something other than a dictionary, as the order
isn't guaranteed.
On 23/09/2014 18:20, Ian Kelly wrote:
On Tue, Sep 23, 2014 at 10:38 AM, Wolfgang Maier
wolfgang.ma...@biologie.uni-freiburg.de wrote:
Maybe fractions.gcd could be renamed, but be wrapped or reimplemented
correctly somewhere else in the stdlib or even in fractions ?
+1
I don't think the
On Tue, Sep 23, 2014 at 11:26 AM, Stefan Behnel stefan...@behnel.de wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and renaming
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and renaming fractions.gcd to fractions._gcd may be a
On Tue, Sep 23, 2014 at 11:39 AM, Ian Kelly ian.g.ke...@gmail.com wrote:
I'm not convinced it's all that clear. In addition to Mathworld and
Wikipedia that were already cited, ProofWiki provides an actual proof
that gcd(a, b) = gcd(|a|, |b|), by way of noting that a and |a| have
the same
Hi EK,
Did you figure out questions 1, 2 and 3? SciPy (0.14.0) on installation asks me
for Python 2.7. First day on Python here, I am really struggling :/
Thanks,
SK
On Saturday, May 10, 2014 7:07:33 PM UTC+2, esa...@gmail.com wrote:
Hi All--
Let me state at the start that I am new to
blindanagram schrieb am 23.09.2014 um 19:43:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and
On Tue, Sep 23, 2014 at 1:54 PM, SK shagunkh...@gmail.com wrote:
Hi EK,
Did you figure out questions 1, 2 and 3? SciPy (0.14.0) on installation asks
me for Python 2.7. First day on Python here, I am really struggling :/
Thanks,
SK
Did you download the SciPy installer for python 3.3? I see
Ian Kelly schrieb am 23.09.2014 um 19:39:
On Tue, Sep 23, 2014 at 11:26 AM, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
Hi,
On Tue, 23 Sep 2014 15:56:41 +0200
Arulnambi Nandagoban wrote:
Hello all,
I developed a multithreaded tcp server with python and I converted into a
windows executable using pyinstaller.
I would like to run the server as a windows service so that server restarts
whenever pc
On 9/23/2014 10:48 AM, Steven D'Aprano wrote:
I have a certain calculation which can be performed two radically different
ways. With the first algorithm, let's call it SHORT, performance is very
fast for small values of the argument, but terrible for large values. For
the second algorithm,
On 23/09/2014 18:43, blindanagram wrote:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I now think the OP is probably right
and renaming
On 9/23/2014 4:16 AM, blindanagram wrote:
What is the rationale for gcd(x, y) in Fractions returning a negative
value when y is negtive?
For example gcd(3, -7) returns -1,
Since the doc says the result will have the same sign as b, this is
intentinal. However, I consider this a *design*
On Sunday, September 21, 2014 9:31:46 PM UTC-5, vek@gmail.com wrote:
I'm messing with SOAP, trying to write a small library to handle stuff I buy
from Aramex (shipper). I'm learning XML/SOAP and I'm familiar with RPC from C
(Stevens) but no other relevant experience. If this is incredibly
On Tue, 23 Sep 2014 09:53:40 -0700, Tobiah wrote:
On 09/23/2014 07:18 AM, luofeiyu wrote:
how can i create the following html
f3 /td
/tr
No tr here?
td
1
...
td
3
/td
tr
What is the above tr doing there?
/tr
/table
[code]
Although your solution will produce valid html, it
On Tue, 23 Sep 2014 17:34:53 +, John Gordon wrote:
In mailman.14262.1411481932.18130.python-l...@python.org luofeiyu
elearn2...@gmail.com writes:
x={'f1':1,'f2':2,'f3':3}
how can i create the following html file automatically with python to
display x ?
You might want to use
Once the runtime of SHORT starts to increase by a certain threshold,
Such as 2x, 4x, or 16x its last runtime? The other ideas already
proposed sound better, but I am wondering if it would work.
On Tue, Sep 23, 2014 at 12:21 PM, Terry Reedy tjre...@udel.edu wrote:
On 9/23/2014 10:48 AM, Steven
I'm following a tutorial about Flask using Python 3.4.1, but I'm getting an
error with a dead simple example:
generator.py:
from flask import Flask, render_template
app = Flask(__name__)
@app.route('/')
def index():
return 'Hello World'
@app.route('/blog/post/')
def post():
return
On 23/09/2014 18:55, Stefan Behnel wrote:
blindanagram schrieb am 23.09.2014 um 19:43:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over module
private vs public naming conventions, I
On 23/09/2014 20:30, Mark Lawrence wrote:
On 23/09/2014 18:43, blindanagram wrote:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over
module
private vs public naming conventions, I now
In mailman.14288.1411507982.18130.python-l...@python.org Juan Christian
juan0christ...@gmail.com writes:
@app.route('/')
def index():
return 'Hello World'
As posted, your code is not indented. Is this literally how your code
looks?
{% block content %}{% endlbock content %}
endlbock is
On Tue, Sep 23, 2014 at 6:48 PM, John Gordon gor...@panix.com wrote:
@app.route('/')
def index():
return 'Hello World'
As posted, your code is not indented. Is this literally how your code
looks?
The mail screwed the indentation, it's indented in the file.
{% block content %}{%
I have some code that I inherited:
' '.join([self.get_abbrev()] +
[str(f['value')
for f in self.filters
if f.has_key('value')]).strip()
This broke today when it encountered some non-ascii data.
I changed the str(f['value']) line to f['value'].encode('utf-8'),
Maybe there are a different way, but you can do this:
' '.join([self.get_abbrev()] +
[str(f['value').encode('utf-8') if type(f['value']) is str else
str(f['value']
for f in self.filters
if f.has_key('value')]).strip()
2014-09-24 0:01 GMT+02:00 Larry Martell
On Tue, Sep 23, 2014 at 3:01 PM, Larry Martell larry.mart...@gmail.com
wrote:
I have some code that I inherited:
' '.join([self.get_abbrev()] +
[str(f['value')
for f in self.filters
if f.has_key('value')]).strip()
This broke today when it encountered
On 22-9-2014 20:28, Chris Angelico wrote:
On Tue, Sep 23, 2014 at 4:23 AM, Irmen de Jong irmen.nos...@xs4all.nl wrote:
This is why Pyro has been using a different (and safe) serializer by default
for a while
now. You have to plow through the usual security warnings in the docs and
make a
On Tue, Sep 23, 2014 at 6:05 PM, Rock Neurotiko
miguelglafue...@gmail.com wrote:
2014-09-24 0:01 GMT+02:00 Larry Martell larry.mart...@gmail.com:
I have some code that I inherited:
' '.join([self.get_abbrev()] +
[str(f['value')
for f in self.filters
if
On 23/09/2014 22:48, blindanagram wrote:
On 23/09/2014 20:30, Mark Lawrence wrote:
On 23/09/2014 18:43, blindanagram wrote:
On 23/09/2014 18:26, Stefan Behnel wrote:
Wolfgang Maier schrieb am 23.09.2014 um 18:38:
While at first I thought this to be a rather irrelevant debate over
module
how can i create the proper html file with /Jinjia/2 or other temple?
Joel Goldstick wrote:
Generally, you would use a framework like django or others.
--
https://mail.python.org/mailman/listinfo/python-list
On 9/23/2014 5:57 PM, Juan Christian wrote:
On Tue, Sep 23, 2014 at 6:48 PM, John Gordon gor...@panix.com
mailto:gor...@panix.com wrote:
@app.route('/')
def index():
return 'Hello World'
As posted, your code is not indented. Is this literally how your code
looks?
The
On 9/23/14 4:53 PM, Denis McMahon wrote:
from string import *
You aren't using any names from string, so you can skip this line.
x={'f1':1,'f2':2,'f3':3}
y = [ (a,x[a]) for a in x.keys() ]
y.sort( cmp=lambda a,b: cmp(a[0],b[0]) )
This is more easily done as:
y = sorted(x.items())
On 2014-09-23, Juan Christian juan0christ...@gmail.com wrote:
if __name__ == '__main__':
app.run(port = 8000)
app.run(port=8000, debug=True) might've made the problem easier to find.
--
https://mail.python.org/mailman/listinfo/python-list
On Tue, Sep 23, 2014 at 8:46 PM, Terry Reedy tjre...@udel.edu wrote:
Did you use tabs? They are more likely to disappear than spaces.
Yes, I use tabs.
On Tue, Sep 23, 2014 at 9:33 PM, Jon Ribbens jon+use...@unequivocal.co.uk
wrote:
app.run(port=8000, debug=True) might've made the problem
dieter wrote:
I have no experience with SOAPpy, but with suds (another Python
SAOP client). A suds client exposes two attributes factory
*miaows happily*
--
https://mail.python.org/mailman/listinfo/python-list
On Tuesday, September 23, 2014 4:37:10 PM UTC+3, Peter Otten wrote:
x eq y
y eq z
not (x eq z)
where eq is the test given above -- should x, y, and z land in the same bin?
Yeah, I know the counting depends on the order of items. But I'm OK with that.
--
On Tuesday, September 23, 2014 7:33:06 PM UTC+3, Rob Gaddi wrote:
While you're at it, think
long and hard about that definition of fuzziness. If you can make it
closer to the concept of histogram bins you'll get much better
performance.
The problem for me here is that I can't determine the
Changes by Raymond Hettinger raymond.hettin...@gmail.com:
--
nosy: +rhettinger
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22464
___
___
Robert Collins added the comment:
This should fix this issue :)
--
keywords: +patch
Added file: http://bugs.python.org/file36694/issue22457.patch
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22457
New submission from Bart Olsthoorn:
CPython tarfile `gettarinfo` method uses fstat to determine the size of a file
(using its fileobject). When that file object is actually created with
Gzip.open (so a GZipfile), it will get the compressed size of the file. The
addfile method will then
Stefan Champailler added the comment:
I don't know if this is 100% related, but here I go. Here's a session in a
windows console (cmd.exe) :
Microsoft Windows [Version 6.1.7601]
Copyright (c) 2009 Microsoft Corporation. All rights reserved.
C:\Users\stcchcp 65001
Active code page: 65001
Stefan Champailler added the comment:
In my previous comment, I've shown :
print '€'
which is not valid python 3.4.1 (don't why the interpreter didn't complaing
though). So I tested again with missing parenthesis added :
C:\PORT-STCA2\pl-PRIVATE\horsechcp 65001
Active code page: 65001
Robert Collins added the comment:
I've managed to get a windows setup working. Its my mini-vfs which needs to be
Windows aware (because the abs path of /foo is C:\\foo). I'll work up a patch
tomorrowish.
--
___
Python tracker rep...@bugs.python.org
Nick Coghlan added the comment:
Drekin, it would be good to be able to incorporate some of your improvements
for Python 3.5. Before we could do that, we'd need to review and agree to the
PSF Contributor Agreement at https://www.python.org/psf/contrib/contrib-form/
The underlying licensing
Drekin added the comment:
Stefan Champailler:
The crash you see is maybe not a crash at all. First it has nothing to do with
printing, the problem is reading of your input line. That explains why Python
exited even before printing the traceback of the SyntaxError. If you try to
read input
Changes by Nick Coghlan ncogh...@gmail.com:
--
assignee: - ncoghlan
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue22166
___
___
Python-bugs-list
Nick Coghlan added the comment:
Updated issue title to reflect current proposal.
--
title: Add tools for cleaning surrogate escaped strings - Add
codecs.convert_surrogateescape to clean surrogate escaped strings
___
Python tracker
Nick Coghlan added the comment:
Updated issue title to indicate proposal also covers bytearray and memoryview.
--
title: introduce bytes.hex method - introduce bytes.hex method (also for
bytearray and memoryview)
___
Python tracker
Nick Coghlan added the comment:
Updated issue title to reflect current proposal
--
title: Add wsgiref.util helpers for dealing with WSGI strings - Add
wsgiref.util.dump_wsgistr load_wsgistr
___
Python tracker rep...@bugs.python.org
Drekin added the comment:
Nick Coghlan: Ok, done.
--
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue1602
___
___
Python-bugs-list mailing list
Nick Coghlan added the comment:
Drekin: thanks! That should get processed by the PSF Secretary before too long,
and the * to indicate you have signed it will appear by your name.
--
___
Python tracker rep...@bugs.python.org
Marc-Andre Lemburg added the comment:
Don't like the function name :-)
How about codecs.filter_non_utf8_data(), since that's closer
to what the function is really doing and doesn't require
knowledge about what surrogateescape is.
--
nosy: +lemburg
Nick Coghlan added the comment:
The error handler is called surrogateescape. That means
convert_surrogateescape is always only a single step away from thinking I
want to remove the smuggled bytes from a surrogateescape'd string, without
needing to assume any knowledge on the part of the user
Nick Coghlan added the comment:
The function definition again, this time with a draft docstring:
def convert_surrogateescape(data, errors='replace'):
Convert escaped raw bytes by applying a different error handler
Uses the replace error handler by default, but any input
Nick Coghlan added the comment:
Note I would also be OK with convert_surrogates, as that's the term that
appears in the relevant error message:
b'\xe9'.decode('ascii', 'surrogateescape').encode()
Traceback (most recent call last):
File stdin, line 1, in module
UnicodeEncodeError: 'utf-8'
Antoine Pitrou added the comment:
Le 23/09/2014 12:57, Nick Coghlan a écrit :
The function definition again, this time with a draft docstring:
def convert_surrogateescape(data, errors='replace'):
Convert escaped raw bytes by applying a different error handler
Uses the
Nick Coghlan added the comment:
Draft docstring for that version
def convert_surrogates(data, errors='replace'):
Convert escaped surrogates by applying a different error handler
Uses the replace error handler by default, but any input
error handler may be specified.
Nick Coghlan added the comment:
Antoine: what would be the use case for using a different encoding for the
temporary bytes object? It's discarded anyway, so the encoding used isn't
externally visible.
--
___
Python tracker rep...@bugs.python.org
Antoine Pitrou added the comment:
The encoding used impacts the result:
s = 'abc\udcc3\udca9'
s.encode('ascii', 'surrogateescape').decode('ascii', 'replace')
'abc��'
s.encode('utf-8', 'surrogateescape').decode('utf-8', 'replace')
'abcé'
The original string ('abc\udcc3\udca9') was obtained
Stefan Champailler added the comment:
Dear Drekin,
The crash you see is maybe not a crash at all. First it has nothing
to do with printing, the problem is reading of your input line.
I guessed that, but thanks for pointing out.
So maybe Python REPL then thinks the input just ended and so
Changes by Barry A. Warsaw ba...@python.org:
--
nosy: +barry
___
Python tracker rep...@bugs.python.org
http://bugs.python.org/issue9951
___
___
Python-bugs-list mailing
1 - 100 of 166 matches
Mail list logo