Re: Latency for API call to a Python Function

2017-08-30 Thread dieter
shazianu...@gmail.com writes:
> I have an issue with one piece of code in Python that when my API using 
> Nginx/Uwsgi/EC2 AWS calls this function it causes latency.

In those cases, I proceed as follows:

 * structure the code in a way that it can be called in an interactive
   Python interpreter (if your Web framework does not directly
   support profiling)

 * use profiling (see the "profile" module in the Python library;
   there are also C variants (-> "cProfile", "hotspot").
   to find out where latency is introduced

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


RE: pip which should be installed with Python3.62 doesn't workinwindows

2017-08-30 Thread Bear Light
I finally solve the problem with Python”3.5.4”
The pip-related files are correctly installed into “scripts”, and I can use the 
pip command now.

I try to install Python “3.6.2” which was released on 2017-07-17 again, and 
then there’s still no files in “scripts”.
I still don’t know why but at least the problem killing me lots of time was 
solved, thx to everyone who saw this mail.

寄件者: Bear Light
傳送時間: 2017年8月30日 上午 11:47
收件者: python-list@python.org
主旨: RE: pip which should be installed with Python3.62 doesn't workinwindows

Thanks for help but it doesn’t work.

(cmd)
C:\Users\user>py -3.6 -m pip install regex
C:\Program Files\Python36\python.exe: No module named pip

The picture that I attached showed similar result.
Though you can see the option of installing pip during python3 installing, the 
command about pip doesn’t work. 
I can install pip manually, but according to the tutorials, it shouldn’t be 
necessary.

What’s more, though people say you can find something like pip.py or pip3.py in 
the Python36/scripts folder, there is nothing in the scripts folder for me. Is 
it unusual?

寄件者: MRAB
傳送時間: 2017年8月30日 上午 05:07
收件者: python-list@python.org
主旨: Re: pip which should be installed with Python3.62 doesn't work inwindows

On 2017-08-29 20:10, Bear Light wrote:
> I found many rookies like me asking similar question: why "pip" is not
> recognized by cmd?
> I install Python 3.62 64bit in Win10 and I'm sure I add PATH, the Python
> tutorial doesn't even mention about PATH.
> You can see the following picture showing the tutorial doesn't work.

This newsgroup is text-only.

> Please give a hand to the helpless rookies and me.
> 
> [image: 內置圖片 1]
> tutorials url:
> https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments
> 
The best way is to use the Python "launcher" py.exe, which should be on 
the search path, so instead of, say:

 pip install regex

you would write:

 py -3.6 -m pip install regex

This ensures that it's installed into the correct version of Python (in 
this case v3.6).
-- 
https://mail.python.org/mailman/listinfo/python-list


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


trouble consuming null data from wsdl with suds.client

2017-08-30 Thread kevinalejandromolina
i was trying to consume the service but i always have the same error,  look 
over the error message, and i am think that the error is, the suds library does 
not support null values on the attributes.

>>> r=client.service.WSOBTENERINTERRUPCIONWEB(1,1)
Traceback (most recent call last):
  File "", line 1, in 
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\client.py", line 542, in 
__call__
return client.invoke(args, kwargs)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\client.py", line 602, in 
invoke
result = self.send(soapenv)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\client.py", line 643, in 
send
result = self.succeeded(binding, reply.message)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\client.py", line 678, in 
succeeded
reply, result = binding.get_reply(self.method, reply)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\bindings\binding.py", 
line 165, in get_reply
result = unmarshaller.process(nodes[0], resolved)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\typed.py", line 66, 
in process
return Core.process(self, content)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 48, in 
process
return self.append(content)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 63, in 
append
self.append_children(content)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 140, 
in append_children
cval = self.append(cont)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 63, in 
append
self.append_children(content)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 140, 
in append_children
cval = self.append(cont)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\core.py", line 64, in 
append
self.append_text(content)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\typed.py", line 133, 
in append_text
content.text = self.translated(content.text, known)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\umx\typed.py", line 139, 
in translated
return resolved.translate(value)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\xsd\sxbuiltin.py", line 
141, in translate
return Date(value).date
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\sax\date.py", line 53, in 
__init__
self.date = self.__parse(date)
  File "C:\Python27\ArcGIS10.2\lib\site-packages\suds\sax\date.py", line 104, 
in __parse
raise ValueError, 'Invalid format "%s"' % s
ValueError: Invalid format "
"
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: pip which should be installed with Python3.62 doesn't work inwindows

2017-08-30 Thread MRAB

On 2017-08-30 04:47, Bear Light wrote:

Thanks for help but it doesn’t work.

(cmd)
C:\Users\user>py -3.6 -m pip install regex
C:\Program Files\Python36\python.exe: No module named pip

The picture that I attached showed similar result.
Though you can see the option of installing pip during python3 installing, the 
command about pip doesn’t work.
I can install pip manually, but according to the tutorials, it shouldn’t be 
necessary.

What’s more, though people say you can find something like pip.py or pip3.py in 
the Python36/scripts folder, there is nothing in the scripts folder for me. Is 
it unusual?


I'm currently on Python 3.6.1 and that did install pip.


寄件者: MRAB
傳送時間: 2017年8月30日 上午 05:07
收件者: python-list@python.org
主旨: Re: pip which should be installed with Python3.62 doesn't work inwindows

On 2017-08-29 20:10, Bear Light wrote:

I found many rookies like me asking similar question: why "pip" is not
recognized by cmd?
I install Python 3.62 64bit in Win10 and I'm sure I add PATH, the Python
tutorial doesn't even mention about PATH.
You can see the following picture showing the tutorial doesn't work.


This newsgroup is text-only.


Please give a hand to the helpless rookies and me.

[image: 內置圖片 1]
tutorials url:
https://packaging.python.org/tutorials/installing-packages/#creating-virtual-environments


The best way is to use the Python "launcher" py.exe, which should be on
the search path, so instead of, say:

  pip install regex

you would write:

  py -3.6 -m pip install regex

This ensures that it's installed into the correct version of Python (in
this case v3.6).



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


Re: pip which should be installed with Python3.62 doesn't work inwindows

2017-08-30 Thread MRAB

On 2017-08-30 14:34, MRAB wrote:

On 2017-08-30 04:47, Bear Light wrote:

Thanks for help but it doesn’t work.

(cmd)
C:\Users\user>py -3.6 -m pip install regex
C:\Program Files\Python36\python.exe: No module named pip

The picture that I attached showed similar result.
Though you can see the option of installing pip during python3 installing, the 
command about pip doesn’t work.
I can install pip manually, but according to the tutorials, it shouldn’t be 
necessary.

What’s more, though people say you can find something like pip.py or pip3.py in 
the Python36/scripts folder, there is nothing in the scripts folder for me. Is 
it unusual?


I'm currently on Python 3.6.1 and that did install pip.


[snip]

Just installed Python 3.6.2 using the "executable installer". Pip was 
included.

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


RE: pip which should be installed with Python3.62 doesn't workinwindows

2017-08-30 Thread Bear Light
On 2017-08-30 14:34, MRAB wrote:
> Just installed Python 3.6.2 using the "executable installer". Pip was 
included.
Yeah, I did. Actually I tried a few times, every time the install of ver. 3.6.2 
seems to succeed but it didn’t.  Since Python 3.5.4 is working good now, I’m 
okay with that. 
Thanks for your advise.


寄件者: MRAB
傳送時間: 2017年8月30日 下午 10:02
收件者: python-list@python.org
主旨: Re: pip which should be installed with Python3.62 doesn't workinwindows

On 2017-08-30 14:34, MRAB wrote:
> On 2017-08-30 04:47, Bear Light wrote:
>> Thanks for help but it doesn’t work.
>> 
>> (cmd)
>> C:\Users\user>py -3.6 -m pip install regex
>> C:\Program Files\Python36\python.exe: No module named pip
>> 
>> The picture that I attached showed similar result.
>> Though you can see the option of installing pip during python3 installing, 
>> the command about pip doesn’t work.
>> I can install pip manually, but according to the tutorials, it shouldn’t be 
>> necessary.
>> 
>> What’s more, though people say you can find something like pip.py or pip3.py 
>> in the Python36/scripts folder, there is nothing in the scripts folder for 
>> me. Is it unusual?
>> 
> I'm currently on Python 3.6.1 and that did install pip.
> 
[snip]

Just installed Python 3.6.2 using the "executable installer". Pip was 
included.
-- 
https://mail.python.org/mailman/listinfo/python-list

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


If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Terry Reedy

https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number

reports the following:
-
Microsoft Windows [Version 10.0.16251.1002]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Adam>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit 
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(1.3)
Traceback (most recent call last):
 File "", line 1, in 
ValueError: math domain error
>>>

I upgraded from version 3.6.1 to 3.6.2 to try to resolve the issue and 
restarted my computer but it is still occurring. Some numbers are 
working (1.2, 1.4) and some others are also not working (1.128).



Neither installed 64 bit 3.6.2 nor my repository 3.6 32-bit debug build 
reproduce this.  If anyone has the python.org 32bit 3.6.1/2 releases 
installed on Windows, please test and report.


--
Terry Jan Reedy

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


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread MRAB

On 2017-08-30 18:35, Terry Reedy wrote:

https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number

reports the following:
-
Microsoft Windows [Version 10.0.16251.1002]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Adam>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit
(Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
  >>> import math
  >>> math.sqrt(1.3)
Traceback (most recent call last):
   File "", line 1, in 
ValueError: math domain error
  >>>

I upgraded from version 3.6.1 to 3.6.2 to try to resolve the issue and
restarted my computer but it is still occurring. Some numbers are
working (1.2, 1.4) and some others are also not working (1.128).


Neither installed 64 bit 3.6.2 nor my repository 3.6 32-bit debug build
reproduce this.  If anyone has the python.org 32bit 3.6.1/2 releases
installed on Windows, please test and report.

Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit 
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(1.3)
1.140175425099138
>>>

This is on 64-bit Windows 10.
--
https://mail.python.org/mailman/listinfo/python-list


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Jerry Hill
On Wed, Aug 30, 2017 at 1:48 PM, MRAB  wrote:
>
> On 2017-08-30 18:35, Terry Reedy wrote:
>>
>> https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number
>>
>> reports the following:
>> -
>> Microsoft Windows [Version 10.0.16251.1002]
>> (c) 2017 Microsoft Corporation. All rights reserved.
>>
>> C:\Users\Adam>python
>> Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit
>> (Intel)] on win32
>> Type "help", "copyright", "credits" or "license" for more information.
>>   >>> import math
>>   >>> math.sqrt(1.3)
>> Traceback (most recent call last):
>>File "", line 1, in 
>> ValueError: math domain error
>>   >>>
>>
>> I upgraded from version 3.6.1 to 3.6.2 to try to resolve the issue and
>> restarted my computer but it is still occurring. Some numbers are
>> working (1.2, 1.4) and some others are also not working (1.128).
>> 
>>
>> Neither installed 64 bit 3.6.2 nor my repository 3.6 32-bit debug build
>> reproduce this.  If anyone has the python.org 32bit 3.6.1/2 releases
>> installed on Windows, please test and report.
>>
> Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit 
> (Intel)] on win32
> Type "help", "copyright", "credits" or "license" for more information.
> >>> import math
> >>> math.sqrt(1.3)
> 1.140175425099138
> >>>
>
> This is on 64-bit Windows 10.
> --
> https://mail.python.org/mailman/listinfo/python-list


This all seems to work fine with python 3.6.1 on Windows 7 (64-bit OS,
32-bit python).

Python 3.6.1 (v3.6.1:69c0db5, Mar 21 2017, 17:54:52) [MSC v.1900 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(1.3)
1.140175425099138
>>>

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


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread 20/20 Lab

On 08/30/2017 10:35 AM, Terry Reedy wrote:
https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number 



reports the following:
-
Microsoft Windows [Version 10.0.16251.1002]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Adam>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 
bit (Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
>>> import math
>>> math.sqrt(1.3)
Traceback (most recent call last):
 File "", line 1, in 
ValueError: math domain error
>>>

I upgraded from version 3.6.1 to 3.6.2 to try to resolve the issue and 
restarted my computer but it is still occurring. Some numbers are 
working (1.2, 1.4) and some others are also not working (1.128).



Neither installed 64 bit 3.6.2 nor my repository 3.6 32-bit debug 
build reproduce this.  If anyone has the python.org 32bit 3.6.1/2 
releases installed on Windows, please test and report.




Works here.

Python 3.6.2 (v3.6.2:5fd33b5, Jul 8 2017, 04:14:34) [MSC v.1900 32 bit 
(Intel)] on win32

Type "copyright", "credits" or "license()" for more information.
>>> import math
>>> math.sqrt(1.3)
1.140175425099138
>>>

Fresh windows7 x64 install with python 32bit

(My apologies to Terry for "Reply" instead of "Reply to List")

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


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Ian Kelly
In the Stack Overflow thread, rosuav wrote:
> Quick smoke-test: can you show the value of math.__file__ please? Editing 
> your question to add that would eliminate a particular class of issue (or 
> reveal the problem, perhaps).

(Replying here because SO requires 50 reputation to comment, and the
requirement to have sufficient reputation to do anything on that site
is the origin of the reason I don't have any reputation)

If there were a math.py file in the path, there would have to be a
sqrt function inside it, and then wouldn't the call stack reflect
that?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Chris Angelico
On Thu, Aug 31, 2017 at 6:24 AM, Ian Kelly  wrote:
> In the Stack Overflow thread, rosuav wrote:
>> Quick smoke-test: can you show the value of math.__file__ please? Editing 
>> your question to add that would eliminate a particular class of issue (or 
>> reveal the problem, perhaps).
>
> (Replying here because SO requires 50 reputation to comment, and the
> requirement to have sufficient reputation to do anything on that site
> is the origin of the reason I don't have any reputation)
>
> If there were a math.py file in the path, there would have to be a
> sqrt function inside it, and then wouldn't the call stack reflect
> that?

That's why it's called a smoke test. It's a basic test to ensure that
the obvious stuff is working. I fully expect to see that it's getting
the correct file - but imagine if, due to a messed-up PYTHONPATH,
"import math" is getting a module from a different version of Python.

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


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Terry Reedy

On 8/30/2017 1:35 PM, Terry Reedy wrote:
https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-when-square-rooting-a-positive-number 



reports the following:
-
Microsoft Windows [Version 10.0.16251.1002]
(c) 2017 Microsoft Corporation. All rights reserved.

C:\Users\Adam>python
Python 3.6.2 (v3.6.2:5fd33b5, Jul  8 2017, 04:14:34) [MSC v.1900 32 bit 
(Intel)] on win32

Type "help", "copyright", "credits" or "license" for more information.
 >>> import math
 >>> math.sqrt(1.3)
Traceback (most recent call last):
  File "", line 1, in 
ValueError: math domain error
 >>>

I upgraded from version 3.6.1 to 3.6.2 to try to resolve the issue and 
restarted my computer but it is still occurring. Some numbers are 
working (1.2, 1.4) and some others are also not working (1.128).



Neither installed 64 bit 3.6.2 nor my repository 3.6 32-bit debug build 
reproduce this.  If anyone has the python.org 32bit 3.6.1/2 releases 
installed on Windows, please test and report.


Three people have reported that math.sqrt(1.3) works in 32 bit Python on 
64-bit Windows and no one otherwise.  I reported back on SO that the 
problem is likely local.  Thanks for the responses.


--
Terry Jan Reedy


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


Re: If you are running 32-bit 3.6 on Windows, please test this

2017-08-30 Thread Steven D'Aprano
On Wed, 30 Aug 2017 20:46:54 -0400, Terry Reedy wrote:

> On 8/30/2017 1:35 PM, Terry Reedy wrote:
>> https://stackoverflow.com/questions/45965545/math-sqrt-domain-error-
when-square-rooting-a-positive-number
[...]

> Three people have reported that math.sqrt(1.3) works in 32 bit Python on
> 64-bit Windows and no one otherwise.  I reported back on SO that the
> problem is likely local.  Thanks for the responses.

I wouldn't entirely rule out a bug yet.

Do the Python Devs have a windows build-bot? If so, perhaps:

- it is currently failing, and nobody noticed;
- it's not failing, because the tests don't cover this case.


The tests for sqrt are not exactly extensive, and the poster on SO 
reports sqrt only fails on *some* numbers, not all.

https://github.com/python/cpython/blob/master/Lib/test/test_math.py


def testSqrt(self):
self.assertRaises(TypeError, math.sqrt)
self.ftest('sqrt(0)', math.sqrt(0), 0)
self.ftest('sqrt(1)', math.sqrt(1), 1)
self.ftest('sqrt(4)', math.sqrt(4), 2)
self.assertEqual(math.sqrt(INF), INF)
self.assertRaises(ValueError, math.sqrt, -1)
self.assertRaises(ValueError, math.sqrt, NINF)
self.assertTrue(math.isnan(math.sqrt(NAN)))



As far as I can see, apart from tests for NAN and ±INF, there are no 
tests of math.sqrt on floats at all.




-- 
Steven D'Aprano
“You are deluded if you think software engineers who can't write 
operating systems or applications without security holes, can write 
virtualization layers without security holes.” —Theo de Raadt
-- 
https://mail.python.org/mailman/listinfo/python-list