Re: Unicode failure

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain"  wrote:

>...
>utf-8
>Traceback (most recent call last):
>  File "./g", line 5, in 
>print(u"\N{TRADE MARK SIGN}")
>UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in
>position 0: ordinal not in range(128)

I *presume* that you're using Linux since you've got a hashbang, so...

You can *check* that it's the local environment that's the issue with
the *test* of setting the PYTHONIOENCODING environment variable. But if
that works, then it tells you must then fix the underlying environment's
character encoding to give a permanent fix.

$ PYTHONIOENCODING=UTF-8 python3 -c 'print(u"\u00A9")'
©

$ PYTHONIOENCODING=ascii python3 -c 'print(u"\u00A9")'
Traceback (most recent call last):
  File "", line 1, in 
UnicodeEncodeError: 'ascii' codec can't encode character '\xa9' in
position 0: ordinal not in range(128)
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode failure

2015-12-06 Thread Dave Farrance
I was taking it for granted that you knew how to set environment
variables, but just in case you don't: In the shell, (are you using
BASH?), put this:

export PYTHONIOENCODING=UTF-8

...then run your script.

Remember that this is *not* a permanent fix.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode failure

2015-12-06 Thread Mark Lawrence

On 06/12/2015 09:06, Dave Farrance wrote:

"D'Arcy J.M. Cain"  wrote:


...
utf-8
Traceback (most recent call last):
  File "./g", line 5, in 
print(u"\N{TRADE MARK SIGN}")
UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in
position 0: ordinal not in range(128)


I *presume* that you're using Linux since you've got a hashbang, so...



Not really a good presumption as the hashbang has been used in Python 
scripts on Windows ever since "PEP 397 -- Python launcher for Windows", 
see https://www.python.org/dev/peps/pep-0397/


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

Mark Lawrence

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


Re: urllib2.urlopen() crashes on Windows 2008 Server

2015-12-06 Thread Ulli Horlacher
Dennis Lee Bieber  wrote:

> >> Connection reset by peer.
> >> 
> >> An existing connection was forcibly closed by the remote host. 
> >
> >This is not true.
> >The server is under my control. Die client has terminated the connection
> >(or a router between).

> The odds are still good that something on the server is configured to
> not make a clean shutdown of TCP connections (a router should not be
> involved as the TCP connection is from client IP to server IP, regardless
> of intervening MAC Ethernet routing). The RST is coming from the server.

No.
The server does not reset the connection.
It is the router/firewall.


> >How can I trap this within the python program?
> >I see no exception.
> 
> It's a socket error
> 
> https://docs.python.org/2/library/socket.html
> """
> 
> exception socket.error

Ok, I have now:

   try:
 req = urllib.Request(szurl)
 req.add_header('User-Agent',useragent)
 u = urllib.urlopen(req)
   except urllib.URLError as e:
 die('cannot get %s - %s' % (szurl,e.reason))
   except urllib.HTTPError as e:
 die('cannot get %s - server reply: %d %s' % (szurl,e.code,e.reason))
   except (IOError,httplib.BadStatusLine,httplib.HTTPException):
 die('cannot get %s - connection reset by router or firewall' % szurl)
   except socket.error as msg:
 die('cannot get %s - %s' % (szurl,msg))


-- 
Ullrich Horlacher  Server und Virtualisierung
Rechenzentrum IZUS/TIK E-Mail: [email protected]
Universitaet Stuttgart Tel:++49-711-68565868
Allmandring 30aFax:++49-711-682357
70550 Stuttgart (Germany)  WWW:http://www.tik.uni-stuttgart.de/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Unicode failure (Solved)

2015-12-06 Thread Dave Farrance
"D'Arcy J.M. Cain"  wrote:

>On Fri, 4 Dec 2015 18:28:22 -0500
>Terry Reedy  wrote:
>> Tk widgets, and hence IDLE windows, will print any character from
>> \u to \u without raising, even if the result is blank or ?.
>> Higher codepoints fail, but allowing the entire BMP is better than
>> any Windows codepage.
>
>Thanks to all.  Following up on the various posts brought me to
>information that solved my problem.  Basicall I added "export
>PYTHONIOENCODING=utf8" to my environment and "SetEnv PYTHONIOENCODING
>utf8" in my Apache config and now things are working as they should.
>
>Thanks all.

Hmmm. I hadn't seen this post before replying to the original because my
newsreader put this post in a later thread because:

(a) The subject header was changed
(b) The reference header is for a post that's not present in Usenet

That raises another question.  I'm seeing a number of broken threads
because people reply to posts that are not present in Usenet.  It's not
just my main news-server because my newreader can gather posts from
several Usenet servers and those posts are nowhere on Usenet.

Case in point:  The post by Terry Reedy quoted above, reference
. I presume that it's on the list server
even though it's not on Usenet.  Anybody know what's going on?
-- 
https://mail.python.org/mailman/listinfo/python-list


Brief Code Review Please - Learning Python

2015-12-06 Thread qualityaddictorg
[Note: Tried sending this twice to the Python-List mail list but I never saw it 
come through to the list.]

Hello everyone,

I am beginning to learn Python, and I've adapted some code from Google into 
the function below.  I'm also looking at the PEP 8 style guide.  I'd appreciate 
a brief code review so I can start this journey off on a solid foundation.  :)

* I've already changed my editor from tabs to 4 spaces.
* I've also set my editor to alert me at 72 characters and don't exceed 79 
characters.
* I've named the function and variables with lower case, underscore 
separated, and meaningful words.
* I've surrounded this function with two blank lines before and after.
* I just recognized I need to pick a quote style and stick to it so I'll 
fix that (" " or ' ').
* I'm not sure about the WidthAndHeight on lines 16 and 17 regarding 
capitalization.
If I understand correctly a namedtuple is a class so the CapWords 
convention is correct.
* Is how I've aligned the function arguments on lines 1-4 and 22-25 good 
style or \
is spreading these out onto fewer lines preferred?
* Same question as right above but with the if tests on lines 5-8.
* I've also used ( ) around the if tests, but I'm not sure if this is good 
Python style or not.

 1  def measure_string(desired_text,
 2 desired_font_family,
 3 desired_font_size,
 4 is_multi_lines):
 5  if (desired_text != '') and \
 6 (desired_font_family != '') and \
 7 (desired_font_size != '') and \
 8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
 9  with Image(filename='wizard:') as temp_image:
10  with Drawing() as measure:
11  measure.font_family = desired_font_family
12  measure.font_size = desired_font_size
13  measures = measure.get_font_metrics(temp_image,
14  desired_text,
15  
multiline=is_multi_lines)
16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")
17  width_and_height = WidthAndHeight(measures.text_width, \
18measures.text_height)
19  return width_and_height
20
21
22  print(measure_string("some text\na new line",
23   "Segoe UI",
24   40,
25   "True"))

Any and all feedback is much appreciated.  As I said, I'm just beginning to 
learn Python and want to start off with a solid foundation.  Thank you to 
everyone in advance for your time and thoughts.

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


Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Joel Goldstick
On Sun, Dec 6, 2015 at 12:21 PM,  wrote:

> [Note: Tried sending this twice to the Python-List mail list but I never
> saw it come through to the list.]
>
> Hello everyone,
>
> I am beginning to learn Python, and I've adapted some code from Google
> into the function below.  I'm also looking at the PEP 8 style guide.  I'd
> appreciate a brief code review so I can start this journey off on a solid
> foundation.  :)
>
> * I've already changed my editor from tabs to 4 spaces.
> * I've also set my editor to alert me at 72 characters and don't
> exceed 79 characters.
> * I've named the function and variables with lower case, underscore
> separated, and meaningful words.
> * I've surrounded this function with two blank lines before and after.
> * I just recognized I need to pick a quote style and stick to it so
> I'll fix that (" " or ' ').
> * I'm not sure about the WidthAndHeight on lines 16 and 17 regarding
> capitalization.
>

You don't need the parens.  If you feel it is easier to understand with
them, they won't hurt


> If I understand correctly a namedtuple is a class so the CapWords
> convention is correct.
> * Is how I've aligned the function arguments on lines 1-4 and 22-25
> good style or \
> is spreading these out onto fewer lines preferred?
>

If the parameters fit on one line, I think that is more common


> * Same question as right above but with the if tests on lines 5-8.
> * I've also used ( ) around the if tests, but I'm not sure if this is
> good Python style or not.
>
>  1  def measure_string(desired_text,
>  2 desired_font_family,
>  3 desired_font_size,
>  4 is_multi_lines):
>  5  if (desired_text != '') and \
>  6 (desired_font_family != '') and \
>  7 (desired_font_size != '') and \
>  8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
>

The above test will always be True.  Look up what is considered True in
Python, and what is False.  I imagine you don't want quotes around True and
False.  Any string will == True


>  9  with Image(filename='wizard:') as temp_image:
> 10  with Drawing() as measure:
> 11  measure.font_family = desired_font_family
> 12  measure.font_size = desired_font_size
> 13  measures = measure.get_font_metrics(temp_image,
> 14  desired_text,
> 15
> multiline=is_multi_lines)
>

No need to set multiline = ... when is_multiline is already defined


> 16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")
> 17  width_and_height = WidthAndHeight(measures.text_width, \
> 18measures.text_height)
> 19  return width_and_height
> 20
> 21
> 22  print(measure_string("some text\na new line",
> 23   "Segoe UI",
> 24   40,
> 25   "True"))
>
> Any and all feedback is much appreciated.  As I said, I'm just beginning
> to learn Python and want to start off with a solid foundation.  Thank you
> to everyone in advance for your time and thoughts.
>
>   Jason
> --
> https://mail.python.org/mailman/listinfo/python-list
>



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


Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Chris Angelico
On Mon, Dec 7, 2015 at 4:34 AM, Joel Goldstick  wrote:
>>  5  if (desired_text != '') and \
>>  6 (desired_font_family != '') and \
>>  7 (desired_font_size != '') and \
>>  8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
>>
>
> The above test will always be True.  Look up what is considered True in
> Python, and what is False.  I imagine you don't want quotes around True and
> False.  Any string will == True

Not sure what you mean by this. If you're talking about boolification,
then an empty string counts as false, but that's not what's happening
here. It's checking that the string be equal to one of two other
strings - and Python behaves exactly the way any sane person would
expect, and this condition is true only if the string is exactly equal
to either "True" or "False".

But I think this line of code should be unnecessary. It's guarding the
entire body of the function in a way that implies that failing this
condition is an error - but if there is such an error, the function
quietly returns None. Instead, I would go for a "fail-and-bail" model:

def measure_string(text, font_family, font_size, multiline):
if not text:
raise ValueError("Cannot measure empty string")
if not font_family:
raise ValueError("No font family specified")
if multiline not in ("True", "False"):
raise ValueError("Must specify 'True' or 'False' for multiline flag")
... body of function here ...

(Incidentally, it's quite un-Pythonic to use "True" and "False" as
parameters; if the function you're calling requires this, it might be
worth papering over that by having *your* function take the bools True
and False, and converting to the strings on the inside.)

> 16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")

You're creating a brand new namedtuple type every time you enter this
function. That's expensive and messy. I would recommend either (a)
constructing one "Dimension" type, outside the function, and using
that every time; or (b) returning a regular tuple of width,height
without the names. The convention of width preceding height (or x
preceding y, more generally) is sufficiently widespread that it's
unlikely to confuse people.

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


Re: Brief Code Review Please - Learning Python

2015-12-06 Thread Peter Otten
[email protected] wrote:

> [Note: Tried sending this twice to the Python-List mail list but I never
> [saw it come through to the list.]
> 
> Hello everyone,
> 
> I am beginning to learn Python, and I've adapted some code from Google
> into the function below.  I'm also looking at the PEP 8 style guide. 
> I'd appreciate a brief code review so I can start this journey off on
> a solid foundation.  :)
> 
> * I've already changed my editor from tabs to 4 spaces.
> * I've also set my editor to alert me at 72 characters and don't
> exceed 79 characters. * I've named the function and variables with
> lower case, underscore separated, and meaningful words. * I've
> surrounded this function with two blank lines before and after. * I
> just recognized I need to pick a quote style and stick to it so I'll
> fix that (" " or ' '). * I'm not sure about the WidthAndHeight on
> lines 16 and 17 regarding capitalization.
> If I understand correctly a namedtuple is a class so the CapWords
> convention is correct.
> * Is how I've aligned the function arguments on lines 1-4 and 22-25
> good style or \
> is spreading these out onto fewer lines preferred?
> * Same question as right above but with the if tests on lines 5-8.
> * I've also used ( ) around the if tests, but I'm not sure if this is
> good Python style or not.
> 
>  1  def measure_string(desired_text,
>  2 desired_font_family,
>  3 desired_font_size,
>  4 is_multi_lines):
>  5  if (desired_text != '') and \
>  6 (desired_font_family != '') and \
>  7 (desired_font_size != '') and \
>  8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
>  9  with Image(filename='wizard:') as temp_image:
> 10  with Drawing() as measure:
> 11  measure.font_family = desired_font_family
> 12  measure.font_size = desired_font_size
> 13  measures = measure.get_font_metrics(temp_image,
> 14  desired_text,
> 15 
> multiline=is_multi_lines)
> 16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")
> 17  width_and_height = WidthAndHeight(measures.text_width, \
> 18measures.text_height)
> 19  return width_and_height
> 20
> 21
> 22  print(measure_string("some text\na new line",
> 23   "Segoe UI",
> 24   40,
> 25   "True"))
> 
> Any and all feedback is much appreciated.  As I said, I'm just beginning
> to learn Python and want to start off with a solid foundation.  Thank you
> to everyone in advance for your time and thoughts.
> 
>   Jason

Use short variable names - the "desired_" prefix does not carry much 
information.

Avoid unrelated but similar names: measure or measures -- what's what?

Use consistent names. This is a bit tricky, but I would prefer multiline 
over is_multi_lines because the underlying library uses the former.

Use the right datatype: multiline should be boolean, i. e. True or False, 
not "True" or "False".

Provide defaults if possible: if the multiline argument is missing you can 
scan the text for "\n" and set the flag accordingly

Prefer parens for line continuations

(a and
b) 

over backslashes

a and \
b

Move code that only should be executed once from the function to the global 
namespace: the namedtuple definition should be on the module level.

Use qualified names if you are referring library code: wand.drawing.Drawing 
instead of just Drawing.

Avoid spurious checks, but if you do argument validation fail noisyly, i. e.

"wrong":

def f(fontname):
if is_valid(fontname):
return meaningful_result()
# implicitly return None

"correct":

class InvalidFontname(Exception):
pass

def f(fontname):
if not is_valid(fontname):
raise InvalidFontname(fontname)
return meaningful_result()


With changes along these lines your code might become


from collections import namedtuple

import wand.drawing
import wand.image


Extent = namedtuple("Extent", "width height")


def get_text_extent(
text, font_family, font_size, multiline=None):
"""Determine width and heights for `text`.
"""
if multiline is None:
multiline = "\n" in text

with wand.image.Image(filename='wizard:') as image:
with wand.drawing.Drawing() as measure:
measure.font_family = font_family
measure.font_size = font_size
metrics = measure.get_font_metrics(
image, text, multiline=multiline)

return Extent(
width=metrics.text_width,
height=metrics.text_height)


if __name__ == "__main__":
print(
get_text_extent(
"some text\na

Python 3.5 not work in Windows XP

2015-12-06 Thread amksh
Installer: only 'Cancel' button visible on dialog. 'Install now...' and  
'Customize...' work but invisible (also when deinstalling).


After installing interpreter and launcher not runs (with message 'Access  
denied)'

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


Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members,

I am beginning to learn Python, and I've adapted some code from Google
into the function below.  I'm also looking at the PEP 8 style guide.  I'd
appreciate a brief code review so I can start this journey off on a solid
foundation.  :)

* I've already changed my editor from tabs to 4 spaces.
* I've also set my editor to alert me at 72 characters and don't exceed
79 characters.
* I've named the function and variables with lower case, underscore
separated, and meaningful words.
* I've surrounded this function with two blank lines before and after.
* I just recognized I need to pick a quote style and stick to it so I'll
fix that (" " or ' ').
* I'm not sure about the WidthAndHeight on lines 16 and 17 regarding
capitalization.
If I understand correctly a namedtuple is a class so the CapWords
convention is correct.
* Is how I've aligned the function arguments on lines 1-4 and 22-25 good
style or \
is spreading these out onto fewer lines preferred?
* Same question as right above but with the if tests on lines 5-8.
* I've also used ( ) around the if tests, but I'm not sure if this is
good Python style or not.

 1  def measure_string(desired_text,
 2 desired_font_family,
 3 desired_font_size,
 4 is_multi_lines):
 5  if (desired_text != '') and \
 6 (desired_font_family != '') and \
 7 (desired_font_size != '') and \
 8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
 9  with Image(filename='wizard:') as temp_image:
10  with Drawing() as measure:
11  measure.font_family = desired_font_family
12  measure.font_size = desired_font_size
13  measures = measure.get_font_metrics(temp_image,
14  desired_text,
15
multiline=is_multi_lines)
16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")
17  width_and_height = WidthAndHeight(measures.text_width, \
18measures.text_height)
19  return width_and_height
20
21
22  print(measure_string("some text\na new line",
23   "Segoe UI",
24   40,
25   "True"))

Any and all feedback is much appreciated.  As I said, I'm just beginning to
learn Python and want to start off with a solid foundation.  Thank you to
everyone in advance for your time and thoughts.

  Jason

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


Brief Code Review Please - Learning Python

2015-12-06 Thread Jason Alan Smith
Hello List Members,

I am beginning to learn Python, and I've adapted some code from Google
into the function below.  I'm also looking at the PEP 8 style guide.  I'd
appreciate a brief code review so I can start this journey off on a solid
foundation.  :)

* I've already changed my editor from tabs to 4 spaces.
* I've also set my editor to alert me at 72 characters and don't exceed
79 characters.
* I've named the function and variables with lower case, underscore
separated, and meaningful words.
* I've surrounded this function with two blank lines before and after.
* I just recognized I need to pick a quote style and stick to it so I'll
fix that (" " or ' ').
* I'm not sure about the WidthAndHeight on lines 16 and 17 regarding
capitalization.
If I understand correctly a namedtuple is a class so the CapWords
convention is correct.
* Is how I've aligned the function arguments on lines 1-4 and 22-25 good
style or \
is spreading these out onto fewer lines preferred?
* Same question as right above but with the if tests on lines 5-8.
* I've also used ( ) around the if tests, but I'm not sure if this is
good Python style or not.

 1  def measure_string(desired_text,
 2 desired_font_family,
 3 desired_font_size,
 4 is_multi_lines):
 5  if (desired_text != '') and \
 6 (desired_font_family != '') and \
 7 (desired_font_size != '') and \
 8 ((is_multi_lines == "True") or (is_multi_lines == "False")):
 9  with Image(filename='wizard:') as temp_image:
10  with Drawing() as measure:
11  measure.font_family = desired_font_family
12  measure.font_size = desired_font_size
13  measures = measure.get_font_metrics(temp_image,
14  desired_text,
15
multiline=is_multi_lines)
16  WidthAndHeight = namedtuple("WidthAndHeight", "Width Height")
17  width_and_height = WidthAndHeight(measures.text_width, \
18measures.text_height)
19  return width_and_height
20
21
22  print(measure_string("some text\na new line",
23   "Segoe UI",
24   40,
25   "True"))

Any and all feedback is much appreciated.  As I said, I'm just beginning to
learn Python and want to start off with a solid foundation.  Thank you to
everyone in advance for your time and thoughts.

  Jason

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


Issue

2015-12-06 Thread James Gilliver
Hi!
I have recently installed Python 3.5.0 but cannot open the application! Could 
you help me resolve this issue?
Thanks,James
  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python 3.5 not work in Windows XP

2015-12-06 Thread Laura Creighton
In a message of Sat, 05 Dec 2015 22:22:41 +0600, [email protected] writes:
>Installer: only 'Cancel' button visible on dialog. 'Install now...' and  
>'Customize...' work but invisible (also when deinstalling).
>
>After installing interpreter and launcher not runs (with message 'Access  
>denied)'

Yes, when 3.5.1 we will make that a lot clearer.  Windows XP is not
supported for 3.5 (and later).  Either stick with 3.4 or upgrade
your OS to something more recent.

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


Re: Issue

2015-12-06 Thread Laura Creighton
In a message of Sun, 06 Dec 2015 15:48:18 +, James Gilliver writes:
>Hi!
>I have recently installed Python 3.5.0 but cannot open the application! Could 
>you help me resolve this issue?
>Thanks,James
> 
>-- 
>https://mail.python.org/mailman/listinfo/python-list

What OS version are you running.
What happens when you try to open the application?

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


Re: issues

2015-12-06 Thread Laura Creighton
In a message of Fri, 04 Dec 2015 22:44:53 +, Anna Szaharcsuk via Python-lis
t writes:
>Hello there,
>
>I was trying to install PyCharm, but didn't worked and needed interpreter.
>the computer advised to install the python for windows.
>
>Can you help me, please, PyCharm stillnot working...allways gives a message
>for repair, after- the repair successful and again message for repair...
>
>
>Kind regards,
>Anna

What OS version do you have?  

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


Re: Unicode failure

2015-12-06 Thread Random832
Mark Lawrence  writes:
> On 06/12/2015 09:06, Dave Farrance wrote:
>> "D'Arcy J.M. Cain"  wrote:
>>> utf-8
>>> Traceback (most recent call last):
>>>   File "./g", line 5, in 
>>> print(u"\N{TRADE MARK SIGN}")
>>> UnicodeEncodeError: 'ascii' codec can't encode character '\u2122' in
>>> position 0: ordinal not in range(128)
>>
>> I *presume* that you're using Linux since you've got a hashbang, so...
>
> Not really a good presumption as the hashbang has been used in Python
> scripts on Windows ever since "PEP 397 -- Python launcher for
> Windows", see https://www.python.org/dev/peps/pep-0397/

However, on windows it would typically be codepage 437, 850, or the
like, and the error message would call it a 'charmap' codec. The 'ascii'
codec error is associated with being in a UNIX environment with an unset
(or "C" or "POSIX") locale.

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


Re: issues

2015-12-06 Thread MRAB

On 2015-12-04 22:44, Anna Szaharcsuk via Python-list wrote:

Hello there,

I was trying to install PyCharm, but didn't worked and needed interpreter.
the computer advised to install the python for windows.

Can you help me, please, PyCharm stillnot working...allways gives a message
for repair, after- the repair successful and again message for repair...


Kind regards,
Anna


Are you trying to use Python 3.5 on Windows XP?

That won't work. XP is a very old version that Python 3.5 doesn't
support.

Either use Python 3.4 or update Windows to a more recent version.
--
https://mail.python.org/mailman/listinfo/python-list


Message-IDs on Usenet gateway

2015-12-06 Thread Random832
Dave Farrance  writes:
> That raises another question.  I'm seeing a number of broken threads
> because people reply to posts that are not present in Usenet.  It's not
> just my main news-server because my newreader can gather posts from
> several Usenet servers and those posts are nowhere on Usenet.
>
> Case in point:  The post by Terry Reedy quoted above, reference
> . I presume that it's on the list server
> even though it's not on Usenet.  Anybody know what's going on?

Something weird is going on. On google groups, this message has
a different Message-ID:


At first glance, it might look like Gmane is rewriting the
Message-IDs, but the "gmane" ID seems authentic: It appears in the
reply link in the online mailing list archive, and on the
message in my own mailbox (I use Gmane now, but didn't bother
with unsubscribing, particularly since my Email provider's
search functionality is better.)

This means the Usenet gateway (i.e. the "real" one, that goes to
comp.lang.python) is rewriting the Message-Id.  I've had the
same problem in the other direction (Reference headers for the
"mailman" Message-IDs breaking threading for me), and I'm glad
that this prompted me to investigate properly, since before
today I'd always assumed it was a Gmane problem.  Who is in
charge of the usenet gateway?

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


Re: Message-IDs on Usenet gateway

2015-12-06 Thread Laura Creighton
In a message of Sun, 06 Dec 2015 15:51:54 -0500, Random832 writes:
>Something weird is going on. On google groups, this message has
>a different Message-ID:
>

I think it is this problem.  Start here.
https://mail.python.org/pipermail/mailman-developers/2015-November/025225.html

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


Re: Issue

2015-12-06 Thread Steven D'Aprano
On Mon, 7 Dec 2015 02:48 am, James Gilliver wrote:

> Hi!
> I have recently installed Python 3.5.0 but cannot open the application!
> Could you help me resolve this issue? Thanks,James

Yes, we can help you resolve the issue!

You'll have to give us a bit more information, as we're not really
mind-readers. Start with what operating system you are running, and what
happens when you try to run the application. Is there an error message?
What does it say? If there's no error message, describe what you did, and
what happened. Be *precise* and *detailed*. The more vague you are, the
less we can help.

Oh, I can make one guess... if you're using Windows XP, I'm afraid that
Python 3.5 is not supported. You'll have to either downgrade to Python 3.4,
or upgrade to Windows 7 or higher, or another operating system.


-- 
Steven

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


Problems using celery and pyelasticsearch

2015-12-06 Thread nonami

Hi,

I create a task that uses this function

def get_jobs(specialization, yoe):
try:
key = "SpecAlert-"
if len(specialization):
key += '-'.join(map(str, specialization))

if yoe is not None:
key += '-yoe'.join(yoe)

jobs = memcache_client.get(key)

if not jobs:
spec_param = {'terms': {'jobs.specialization.id': 
specialization}}

if yoe is not None:
if len(yoe) == 2:
yoe_param = {'range': {'jobs.experience': {'gte': 
yoe[0], 'lte': yoe[1]}}}

elif int(yoe[0]):
yoe_param = {'range': {'jobs.experience': {'gte': 
yoe[0]}}}

else:
yoe_param = {'term': {'jobs.experience': yoe[0]}}
query_bool = {'must': [{'range': {'jobs.deadline': {'gt': 
str(date.today() + timedelta(days=1))}}}]}
query_bool['must_not'] = [{'term': {'jobs.job_level': 
JOB_LEVEL_VOC}}]

if specialization:
query_bool['must'].append(spec_param)
if yoe:
query_bool['must'].append(yoe_param)
es = config.get_es_connection()
es_config = config.config['elasticsearch']
# print({'query': {'bool': query_bool}})
try:
# Tasks sometimes hang here
result = es.search(index=es_config['job_index'], 
doc_type=es_config['job_type'],

body={'query': {'bool': query_bool}})
jobs = []
for j in result['hits']['hits']:
jobs.append(j['_source'])
except ElasticsearchException as esc:
print(esc)
jobs = []

if jobs:
memcache_client.set(key, jobs, 3600)
except Exception as e:
jobs = []
print(e)

return jobs

I find that the celery worker often stops executing tasks. After tests 
and debugging I in that this NEVER happens when I take out this line(s):
result = es.search(index=es_config['job_index'], 
doc_type=es_config['job_type'],

body={'query': {'bool': query_bool}})

This line also does not raise any Exceptions

Does anyone have any idea what could be going on or how I can further 
inspect running tasks.
N.B celery worker is started with loglevel=debug flag but does not 
output any useful info as regards the problem.


Thanks

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


Re: Problems using celery and pyelasticsearch

2015-12-06 Thread Laura Creighton
In a message of Mon, 07 Dec 2015 02:37:15 +0100, nonami writes:

>Does anyone have any idea what could be going on or how I can further 
>inspect running tasks.

Not sure this will help, but it might ...
https://www.caktusgroup.com/blog/2013/10/30/using-strace-debug-stuck-celery-tasks/

Laura

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


[RELEASED] Python 3.5.1 and 3.4.4rc1 are now available

2015-12-06 Thread Larry Hastings


On behalf of the Python development community and the Python 3.4 and 3.5 
release teams, I'm pleased to announce the simultaneous availability of 
Python 3.5.1 and Python 3.4.4rc1.   As point releases, both have many 
incremental improvements over their predecessor releases.



You can find Python 3.5.1 here:

   https://www.python.org/downloads/release/python-351/

And you can find Python 3.4.4rc1 here:

   https://www.python.org/downloads/release/python-344rc1/


Python 2.7.11 shipped today too, so it's a Python release-day hat trick!


Happy computing,


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