Re: FW: NEED SOLUTION FOR ERROR

2020-10-13 Thread Kyle Stanley
It would also be helpful to list the full traceback as well as the exact
command used (e.g. package attempted to install and passed arguments to
pip). A bad file descriptor error sounds like there's a fair chance of it
being an issue within a specific module, or something like your OS running
out of FDs (rare, but definitely possible if the max limit is low).

On Sun, Oct 11, 2020 at 10:12 PM MRAB  wrote:

> On 2020-10-11 09:13, hey wrote:
> >
> >
> > Sent from Mail for Windows 10
> >
> > From: hey
> > Sent: Saturday, October 10, 2020 7:40 PM
> > To: python-list@python.org
> > Subject: NEED SOLUTION FOR ERROR
> >
> > I am Akshat Sharma one of python user from INDIA . I am facing problem
> in getting pip installed.
> > When I am trying to install a module using PIP it showing me error : No
> such file found in directory .
> > Then I tried to install pip doing so , I am getting another error :
> OSError [errno 9] Bad File Descriptor.
> > Please guide me what should I do to overcome this type of error.
> > THANK YOU
> > Regards
> >
> You could try using the pip module via the Python launcher.
>
> Instead of:
>
>  pip install something
>
> try:
>
>  py -m pip install something
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Weird behavior for IDLE...

2020-10-13 Thread Steve
Why does IDLE always open with the lowest three lines of the window end up
hidden below the bottom of the screen behind the task bar? Every time I use
it,  I have to stop and grab the top of the window and drag it up to see the
line and row information.  I explored the Options/Configure IDLE but did not
see anything that would help.

It is most annoying, is there a fix for it?
I explored 
Steve
==
Footnote: 
Mars is the only known planet in our solar system solely inhabited by
functioning robots.


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


Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Tony Flury via Python-list
I am trying to write a simple expression to build a raw string that ends 
in a single backslash. My understanding is that a raw string should 
ignore attempts at escaping characters but I get this :


>>> a = r'end\'
  File "", line 1
    a = r'end\'
  ^
   SyntaxError: EOL while scanning string literal

I interpret this as meaning that the \' is actually being interpreted as 
a literal quote - is that a bug ?


If I try to escaped the backslash I get a different problem:

>>> a = r'end\\'
>>> a
   'end'
>>> print(a)
   end\\
>>> len(a)
   5
>>> list(a)
   ['e', 'n', 'd', '\\', '\\']

So you can see that our string (with the escaped backslash)  is now 5 
characters with two literal backslash characters


The only solution I have found is to do this :

>>> a = r'end' + chr(92)
>>> a
   'end\\'
>>> list(a)
   ['e', 'n', 'd', '\\']

or


>>> a = r'end\\'[:-1]
>>> list(a)
   ['e', 'n', 'd', '\\']

Neither of which are nice.



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


Re: Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Eryk Sun
On 10/13/20, Tony Flury via Python-list  wrote:
> I am trying to write a simple expression to build a raw string that ends
> in a single backslash. My understanding is that a raw string should
> ignore attempts at escaping characters but I get this :
>
>  >>> a = r'end\'
>File "", line 1
>  a = r'end\'
>^
> SyntaxError: EOL while scanning string literal

Since r'\'' represents a two-character string with a backslash and a
single quote, ending a raw string literal with an odd number of
backslashes requires adding the final backslash using implicit
string-literal concatenation. For example:

>>> r'some\raw\string''\\'
'some\\raw\\string\\'

Other ways to get the same result may operate at runtime instead of at
compile time.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What might cause my sample program to forget that already imported datetime?

2020-10-13 Thread D'Arcy Cain
On 10/12/20 7:20 AM, Chris Angelico wrote:
> This is yet another reason that "from MODULE import *" is a bad idea.
> Instead, just import the module itself, and take whatever you need.

Or just import the objects that you need;

from datetime import datetime, SYMBOL, etc...

I use Decimal a lot.  I would hate to have to write "decimal.Decimal(str)"
for example.

Whichever method you use the most important thing is to be consistent as
much as possible.

-- 
D'Arcy J.M. Cain
Vybe Networks Inc.
A unit of Excelsior Solutions Corporation - Propelling Business Forward
http://www.VybeNetworks.com/
IM:da...@vybenetworks.com VoIP: sip:da...@vybenetworks.com


OpenPGP_signature
Description: OpenPGP digital signature
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: What might cause my sample program to forget that already imported datetime?

2020-10-13 Thread Chris Angelico
On Tue, Oct 13, 2020 at 9:03 PM D'Arcy Cain  wrote:
>
> On 10/12/20 7:20 AM, Chris Angelico wrote:
> > This is yet another reason that "from MODULE import *" is a bad idea.
> > Instead, just import the module itself, and take whatever you need.
>
> Or just import the objects that you need;
>
> from datetime import datetime, SYMBOL, etc...
>
> I use Decimal a lot.  I would hate to have to write "decimal.Decimal(str)"
> for example.
>
> Whichever method you use the most important thing is to be consistent as
> much as possible.

Yep - either "import module" or "from module import name", but not
"import *". Be precise. Be efficient. Have a plan to import every
module you meet.

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


Re: Weird behavior for IDLE...

2020-10-13 Thread Terry Reedy

On 10/13/2020 4:51 AM, Steve wrote:

Why does IDLE always open with the lowest three lines of the window end up
hidden below the bottom of the screen behind the task bar? Every time I use
it,  I have to stop and grab the top of the window and drag it up to see the
line and row information.  I explored the Options/Configure IDLE but did not
see anything that would help.


The issue is lines on the screen, which depends on screen, font, and 
fontsize, versus lines in the editor window plus lines above the editor 
window.  On the General tab, you can ask for fewer lines in the editor 
window.


Use Options -> Zoom Height to get the max lines possible.

The positioning of the top of the window is the tk default.  This might 
be changed if it became the highest priority.


--
Terry Jan Reedy

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


Re: Covariance matrix syntax

2020-10-13 Thread Bruno P. Kinoshita via Python-list
 I think the np.cov is from the numpy module (imported/aliased as np?).
If so, the numpy repository should have what you are looking for:

https://github.com/numpy/numpy/blob/156cd054e007b05d4ac4829e10a369d19dd2b0b1/numpy/lib/function_base.py#L2276

Hope that helps
Bruno

On Tuesday, 13 October 2020, 5:38:55 pm NZDT, Meghna Karkera 
 wrote:  
 
 May I know the steps or procedure behind covariance matrix syntax,
np.cov(covar_matrix) in python
-- 
https://mail.python.org/mailman/listinfo/python-list
  
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Simple question - end a raw string with a single backslash ?

2020-10-13 Thread Serhiy Storchaka
13.10.20 11:52, Tony Flury via Python-list пише:
> I am trying to write a simple expression to build a raw string that ends
> in a single backslash. My understanding is that a raw string should
> ignore attempts at escaping characters but I get this :
> 
>     >>> a = r'end\'
>       File "", line 1
>         a = r'end\'
>       ^
>    SyntaxError: EOL while scanning string literal
> 
> I interpret this as meaning that the \' is actually being interpreted as
> a literal quote - is that a bug ?

r'You can\'t end raw string literal with a single "\"'

If backslash be true inner in a raw string, the above literal would end
after \'. It would be very hard to write a raw string containing both \'
and \", and even \''' and \""" (there are such strings in the stdlib).

So you have problem either with trailing backslash, or with inner
backslash followed by quotes. Both problems cannot be solved at the same
time. Python parser works as it works because initially it was easier to
implement, and now this cannot be changed because it would break some
amount of correct code.

> The only solution I have found is to do this :
> 
>     >>> a = r'end' + chr(92)
>     >>> a
>    'end\\'
>     >>> list(a)
>    ['e', 'n', 'd', '\\']
> 
> or
> 
> 
>     >>> a = r'end\\'[:-1]
>     >>> list(a)
>    ['e', 'n', 'd', '\\']
> 
> Neither of which are nice.

You can also write r'end' '\\'. It is not too nice, but it looks nicer
to me then two other variants.

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


[ANN] Austin -- CPython frame stack sampler v2.0.0 is now available

2020-10-13 Thread Gabriele
I am delighted to announce the release 2.0.0 of Austin. If you haven't 
heard of Austin before, it is an open source frame stack sampler for 
CPython, distributed under the GPLv3 license. It can be used to obtain 
statistical profiling data out of a running Python application without a 
single line of instrumentation. This means that you can start profiling a 
Python application straightaway, even while it's running on a production 
environment, with minimal impact on performance.

The simplest way of using Austin is by piping its output to FlameGraph 
for a quick and detailed representation of the collected samples. The 
latest release introduces a memory profiling mode which allows you to 
profile memory usage.

Austin is a pure C application that has no other dependencies other than 
the C standard library. Its source code is hosted on GitHub at

https://github.com/P403n1x87/austin

The README contains installation and usage details, as well as some 
examples of Austin in action. Details on how to contribute to Austin's 
development can be found at the bottom of the page.

Austin can be installed easily on the following platforms and from the 
following sources:

Linux:
- Snap Store
- Debian repositories

macOS:
- Homebrew

Windows:
- Chocolatey
- Scoop

Austin is also simple to compile from sources as it only depends on the 
standard C library, if you don't have access to the above listed sources.

Besides support for Python 3.9, this new release of Austin brings a 
considerable performance enhancement that allows it to sample up to 8 
times faster than previous versions. But please do read on until the end 
to find out about some new tools that take advantage of all the key 
features of Austin.

Due to increasing popularity, the sample Python applications that were 
included in the main repository have been moved to dedicated projects on 
GitHub. The TUI can now be found at

https://github.com/P403n1x87/austin-tui

while Austin Web is now available from

https://github.com/P403n1x87/austin-web

They can both be installed easily from PyPI, but in order to use them the 
Austin binary needs to be on the PATH environment variable. These 
projects now rely on the austin-python Python package that provides a 
Python wrapper around Austin. If you are considering making your own 
profiling tool based on Austin, this package can spare you from writing 
boilerplate code, so it's worth having a look at it at

https://github.com/P403n1x87/austin-python

The documentation is hosted on RTD at

https://austin-python.readthedocs.io/en/latest/

Finally, I am happy to announce the release of pytest-austin, a plugin 
for pytest that allows you to set up performance regression testing by 
simply decorating your existing pytest test suite. The plugin launches 
Austin to profile your test runs, meaning that no further instrumentation 
is required. For more details, check out the project on GitHub

https://github.com/P403n1x87/pytest-austin

Like the other Austin tools, pytest-austin can be installed easily from 
PyPI.

You can stay up-to-date with the project's development by following 
Austin on Twitter (https://twitter.com/AustinSampler).

All the best,
Gabriele 


https://github.com/P403n1x87/austin";>Austin 2.0.0 -
frame stack sampler for CPython. (13-Oct-20)
-- 
https://mail.python.org/mailman/listinfo/python-list


lmoments3 and scipy (again)

2020-10-13 Thread David Painter
I'm aware there have been problems with previous versions of
lmoments3 working with scipy -- comb having been replaced in scipy. I
thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
traceback referring to attribute comb not being present in
module scipy.misc.
Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32
bit (Intel)] on win32
Type "help", "copyright", "credits" or "license()" for more information.
>>> import numpy
>>> import scipy
>>> import lmoments3
>>> from lmoments3 import distr
>>> data = [135.2 ,130.1 ,117 ,109.3 ,92.1 ,91.4 ,83.1 ,80.5 ,74.7
,69.8,65.2,58.6,56.5,55.4,54.6,54.5,49.5,48.9,48.3,46.6]
>>> paras = distr.gpa.lmom_fit(data)
Traceback (most recent call last):
  File "", line 1, in 
paras = distr.gpa.lmom_fit(data)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py",
line 59, in lmom_fit
lmom_ratios = lm.lmom_ratios(data, nmom=n_min)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
line 82, in lmom_ratios
return _samlmusmall(data, nmom)
  File
"C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
line 159, in _samlmusmall
l1 = np.sum(x) / sm.comb(n, 1, exact=True)
AttributeError: module 'scipy.misc' has no attribute 'comb'

What am I doing wrong?
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: lmoments3 and scipy (again)

2020-10-13 Thread Kyle Stanley
Based on a search of the scipy docs, it looks like the function might have
moved namespaces from scipy.misc.comb to scipy.special.comb (
https://docs.scipy.org/doc/scipy/reference/generated/scipy.special.comb.html?highlight=comb#scipy-special-comb)
when referenced in lmoments3. Alternatively, if you clone the package from
the repo directly, it seems to have been addressed in a recent commit:
https://github.com/OpenHydrology/lmoments3/commit/3349b90463f649aea02be5dc3726d22e5e500dc3
.

On Wed, Oct 14, 2020 at 12:00 AM David Painter 
wrote:

> I'm aware there have been problems with previous versions of
> lmoments3 working with scipy -- comb having been replaced in scipy. I
> thought by using pip to install numpy, scipy, lmoments3 [whence distr] I
> would get compatible latest versions. I'm using 32-bit Python 3.8.6. I've
> verified scipy 1.5.2 and lmoments3 1.10.4 are present. But I still get a
> traceback referring to attribute comb not being present in
> module scipy.misc.
> Python 3.8.6 (tags/v3.8.6:db45529, Sep 23 2020, 15:37:30) [MSC v.1927 32
> bit (Intel)] on win32
> Type "help", "copyright", "credits" or "license()" for more information.
> >>> import numpy
> >>> import scipy
> >>> import lmoments3
> >>> from lmoments3 import distr
> >>> data = [135.2 ,130.1 ,117 ,109.3 ,92.1 ,91.4 ,83.1 ,80.5 ,74.7
> ,69.8,65.2,58.6,56.5,55.4,54.6,54.5,49.5,48.9,48.3,46.6]
> >>> paras = distr.gpa.lmom_fit(data)
> Traceback (most recent call last):
>   File "", line 1, in 
> paras = distr.gpa.lmom_fit(data)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\distr.py",
> line 59, in lmom_fit
> lmom_ratios = lm.lmom_ratios(data, nmom=n_min)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 82, in lmom_ratios
> return _samlmusmall(data, nmom)
>   File
>
> "C:\Users\David\AppData\Local\Programs\Python\Python38-32\lib\site-packages\lmoments3\__init__.py",
> line 159, in _samlmusmall
> l1 = np.sum(x) / sm.comb(n, 1, exact=True)
> AttributeError: module 'scipy.misc' has no attribute 'comb'
>
> What am I doing wrong?
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list