EuroPython 2020: Ticket sales started

2020-04-21 Thread M.-A. Lemburg
We have started the EuroPython 2020 online conference & sprint ticket
sales today.

   * EuroPython 2020 Ticket Sales *

https://ep2020.europython.eu/registration/buy-tickets/


Simplified ticket structure
---

In order to keep things simple for the EuroPython 2020 online version,
we have significantly reduced the ticket prices and refactored the
ticket structure to just two ticket types and two categories:

Conference & sprint tickets
---

The conference & sprint ticket includes admission to the EuroPython
2020 main conference (July 23-24) and sprints days (July 25-26).

 - Business conference ticket: EUR 175.00 incl. 0% Swedish VAT
   (for people using Python to make a living)

 - Personal conference ticket: EUR 95.00 incl. 0% Swedish VAT
   (for people enjoying Python in their free time or as a freelancer)

Sprint-only tickets
---

Admission to the sprint days (July 25-26) is free of charge, but we
still require you to register and “buy” tickets, since that way we can
send out the conference details using our ticketing system:

 - Business sprint ticket: EUR 0.00 incl. 0% Swedish VAT
   (for people using Python to make a living)

 - Personal sprint ticket: EUR 0.00 incl. 0% Swedish VAT
   (for people enjoying Python in their free time or as a freelancer)

Full details


Please see our registration page for full details on the available tickets:

https://ep2020.europython.eu/registration/buy-tickets/

As a reminder, here’s the conference structure:

 - Thursday & Friday, July 23 & 24:
   Conference talks, keynotes & virtual exhibition

 - Saturday & Sunday, July 25 & 26:
   Sprints

Participate in Talk Voting
--

With conference tickets, you will also be able to participate in the
talk voting which is still available until Sunday, April 26 23:59:59
CEST. Talk voting is your chance to tell us what you’d like to see at
EuroPython 2020.

https://ep2020.europython.eu/events/talk-voting/

Sprints-only tickets are not eligible for talk voting, but if you have
bought a ticket for one of the previous EuroPython conferences, you
can still vote after logging in to the website.

Guido van Rossum Core Developer Grant
-

For Python Core Developers, we have put a special grant in place,
which will allow core developers to get free tickets to the
conference.

If you want to sign up, please check our grant page for details on how
to apply:

https://www.europython-society.org/core-grant


Help spread the word


Please help us spread this message by sharing it on your social
networks as widely as possible. Thank you !

Link to the blog post:

https://blog.europython.eu/post/615992284837756928/europython-2020-ticket-sales-started

Tweet:

https://twitter.com/europython/status/1252508481405550593

Thanks,
--
EuroPython 2020 Team
https://ep2020.europython.eu/
https://www.europython-society.org/

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


Re: "pip" error message

2020-04-21 Thread Simone Bravin

Hi all,

First of all thanks to all that answered my question.

I had already changed the PATH and tried to upgrade pip version but it 
was not possible to reach pip in any way,

the error that I was getting looked like regarding some program file of pip.

Anyway after some trying I was able to fix the problem.

I found that I had downloaded Python from what I would call "automatic 
check version link" and that downloaded the 32-bit version, but my 
notebook have 64-bit, so I changed the version to the 64-bit one.


Pip was reachable but I was getting a problem with it again anyway was 
an easiest fix as I had to take off the -32 from \Python38-32\ in PATH 
variables, like this: 
C:\Users\simon\AppData\Local\Programs\Python\Python38\Scripts


Bye


On 21/04/2020 04:47, Souvik Dutta wrote:
Have you tried updating pip? There was a bug in pip version 
10


Souvik flutter dev

On Mon, Apr 20, 2020, 10:10 PM Simone Bravin 
mailto:[email protected]>> wrote:


Hello everyone,

> I just started using Python to learn a bit of coding, so I'm
pretty a
> newbie to this, I tried to install few extra packages using pip
but it
> doesn't work.
>
> When I check for pip version using command line> pip --version I
get
> the following error message:
>
> Traceback (most recent call last):
>   File
>
"c:\users\simon\appdata\local\programs\python\python38-32\lib\runpy.py",

> line 193, in _run_module_as_main
>     return _run_code(code, main_globals, None,
>   File
>
"c:\users\simon\appdata\local\programs\python\python38-32\lib\runpy.py",

> line 86, in _run_code
>     exec(code, run_globals)
>   File
>

"C:\Users\simon\AppData\Local\Programs\Python\Python38-32\Scripts\pip.exe\__main__.py",

> line 5, in 
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\__init__.py",

> line 40, in 
>     from pip._internal.cli.autocompletion import autocomplete
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\autocompletion.py",

> line 8, in 
>     from pip._internal.cli.main_parser import create_main_parser
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\main_parser.py",

> line 7, in 
>     from pip._internal.cli import cmdoptions
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\cli\cmdoptions.py",

> line 24, in 
>     from pip._internal.models.search_scope import SearchScope
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\models\search_scope.py",

> line 11, in 
>     from pip._internal.utils.misc import normalize_path,
> redact_password_from_url
>   File
>

"c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\_internal\utils\misc.py",

> line 31, in 
> *from pip import __version__ *
> *ImportError: cannot import name '__version__' from 'pip'
>

(c:\users\simon\appdata\local\programs\python\python38-32\lib\site-packages\pip\__init__.py)*
>
> I tried to run Repair in Modify Setup and reinstalled python as
well
> but nothing changed.
>
> I was wondering if you can help to fix this.
>
> Thank you
>
> Simone
-- 
https://mail.python.org/mailman/listinfo/python-list



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


Re: "pip" error message

2020-04-21 Thread Frank Millman

On 2020-04-21 12:02 PM, Simone Bravin wrote:


I found that I had downloaded Python from what I would call "automatic 
check version link" and that downloaded the 32-bit version, but my 
notebook have 64-bit, so I changed the version to the 64-bit one.




I have had the same problem in the past. Most software download pages 
seem to detect whether you are running 32 or 64 bit, and default to the 
correct download option.


Python shows a big yellow 'Download the latest version for Windows' 
button, which most people will select by default. However, it actually 
downloads the 32 bit version, without any indication that this is what 
it is doing.


I could have the details wrong - I am not going to repeat the install 
just to check. But this is what I recall from the last time I did this.


This seems like a good time to bring this up, as in another thread we 
are discussing how to improve the download experience on Windows for 
newbies.


Frank Millman


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


Something annoying about method __set_name__ in descriptors

2020-04-21 Thread ast

Hello

From python version 3.6, there is a useful new method
__set_name__ which could be implemented in descriptors.

This method is called after a descriptor is instantiated
in a class. Parameter "name" is filled with the name
of the attribute refering to the descriptor in the class

Here is an example:

class Descriptor:
def __set_name__(self, owner, name):
print(name)

class A:
value = Descriptor()


value## produced by print in Descriptor


-

But I discovered that __set_name__ is not called immediately
after the execution of line "value = Descriptor()" but after
all class code execution ...

Here is an other example:

class Descriptor:
def __set_name__(self, owner, name):
print("From Descriptor's method __set_name__: ", name)


class Test:
aaa = Descriptor()
print("From class Test")

From class Test
From Descriptor's method __set_name__:  aaa
>>>

As you see, the print from __set_name__ occurs AFTER the print
from the class, I think every body was expecting the print
from __set_name__ before.

It is annoying in some real life, when one descriptor's method
is a decorator and you write things like:


class Temperature:
def __init__(self):
self.celsius= 0

fahrenheit = my_property()

@fahrenheit.getter
def fahrenheit(self):
return 1.8*self.celsius+ 32

@fahrenheit.setter
def fahrenheit(self, value):
self.celsius= (value -32)/1.8

and fahrenheit.getter is expecting an attribute in fahrenheit which
has not been set yet, it will be after all Temperature class code
execution ...









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


Re: Floating point problem

2020-04-21 Thread Pieter van Oostrum
Chris Angelico  writes:

> On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
>  wrote:
>>
>> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
>> fractional bits don't exist, so 53 bits. If you note that the first
>> non-zero digit as 4, and the first digit after the 15 zeroes was 2,
>> then you got an extra bit. 54 bits. Where did the extra bit come from?
>> It came from the IEEE format's assumption that the top bit of the
>> mantissa of a normalized floating point value must be 1. Since we know
>> what it must be, there is no reason to use an actual bit for it. The
>> 53 bits in the mantissa do not include the assumed top bit.
>>
>> Isn't floating point fun?
>>
>
> IEEE 64-bit packed floating point has 53 bits of mantissa, 11 scale
> bits (you've heard of "scale birds" in art? well, these are "scale
> bits"), and 1 sign bit.
>
> 53 + 11 + 1 == 64.

I don't know if this was meant to be sarcasm, but in my universe 53 + 11 + 1 == 
65.
But the floating point standard uses 53 bits of precision where only 52 bits 
are stored.
52 + 11 + 1 == 64.

> Yep, floating point is fun.
>
> That assumed top 1 bit is always there, except when it isn't. Because
> denormal numbers are a thing. They don't have that implied 1 bit.

Yes, for subnormal numbers the implicit bit *is* stored. They are characterized 
by the biased exponent being 0. So these have only 52  bits of precision in the 
mantissa.

> Yep, floating point is fun.
>
> ChrisA

-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: "pip" error message

2020-04-21 Thread Mats Wichmann
On 4/21/20 5:38 AM, Frank Millman wrote:
> On 2020-04-21 12:02 PM, Simone Bravin wrote:
>>
>> I found that I had downloaded Python from what I would call "automatic
>> check version link" and that downloaded the 32-bit version, but my
>> notebook have 64-bit, so I changed the version to the 64-bit one.
>>
> 
> I have had the same problem in the past. Most software download pages
> seem to detect whether you are running 32 or 64 bit, and default to the
> correct download option.
> 
> Python shows a big yellow 'Download the latest version for Windows'
> button, which most people will select by default. However, it actually
> downloads the 32 bit version, without any indication that this is what
> it is doing.
> 
> I could have the details wrong - I am not going to repeat the install
> just to check. But this is what I recall from the last time I did this.
> 
> This seems like a good time to bring this up, as in another thread we
> are discussing how to improve the download experience on Windows for
> newbies.

There's a long-running thread on this in, well, more than one place.

The experts on the Windows experience in general (i.e. Microsoft folks)
maintained for a long time that the 32-bit Python was the correct
default - they have usage statistics on a worldwide basis that nobody
else could have access to. That stance may have softened a bit but
there's been no change to the web page yet.   The web page does OS
detection, but not bitness-detection, and yes that's intentional but
won't go into that here.

The 32-bit Python runs just fine on 64-bit Windows, by the way. There
shouldn't have been a problem with it.  There's also nothing wrong with
switching to the 64-bit version if you like - mainly that choice should
these be driven by what extra packages are available; for a long time it
was more likely that binary wheels were available for 32-bit Python, and
I think now that's actually shifting such that some developers may not
be uploading the 32-bit wheels any longer.


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


Re: Floating point problem

2020-04-21 Thread Chris Angelico
On Tue, Apr 21, 2020 at 11:31 PM Pieter van Oostrum
 wrote:
>
> Chris Angelico  writes:
>
> > On Tue, Apr 21, 2020 at 6:07 AM Schachner, Joseph
> >  wrote:
> >>
> >> 16 base 10 digits / log base10( 2) = 53.1508495182 bits. Obviously,
> >> fractional bits don't exist, so 53 bits. If you note that the first
> >> non-zero digit as 4, and the first digit after the 15 zeroes was 2,
> >> then you got an extra bit. 54 bits. Where did the extra bit come from?
> >> It came from the IEEE format's assumption that the top bit of the
> >> mantissa of a normalized floating point value must be 1. Since we know
> >> what it must be, there is no reason to use an actual bit for it. The
> >> 53 bits in the mantissa do not include the assumed top bit.
> >>
> >> Isn't floating point fun?
> >>
> >
> > IEEE 64-bit packed floating point has 53 bits of mantissa, 11 scale
> > bits (you've heard of "scale birds" in art? well, these are "scale
> > bits"), and 1 sign bit.
> >
> > 53 + 11 + 1 == 64.
>
> I don't know if this was meant to be sarcasm, but in my universe 53 + 11 + 1 
> == 65.
> But the floating point standard uses 53 bits of precision where only 52 bits 
> are stored.
> 52 + 11 + 1 == 64.
>

Exactly - normally, if you want 53 bits plus 11 bits plus 1 bit, it's
going to cost you 65 bits, but due to IEEE magic, it's possible to
store 65 bits of data in 64 bits of memory.

> > Yep, floating point is fun.
> >
> > That assumed top 1 bit is always there, except when it isn't. Because
> > denormal numbers are a thing. They don't have that implied 1 bit.
>
> Yes, for subnormal numbers the implicit bit *is* stored. They are 
> characterized by the biased exponent being 0. So these have only 52  bits of 
> precision in the mantissa.
>

Right. Now try diagnosing weird bugs in floating-point calculations,
and you aren't sure if it's because sometimes you have 53 bits of
mantissa and sometimes only 52.

Like I said, floating point is fun.

Extremely USEFUL and PRACTICAL, but still quite magical.

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


Re: Why is a generator expression called a expression?

2020-04-21 Thread Pieter van Oostrum
Veek M  writes:

> The docs state that a expression is some combination of value, operator, 
> variable and function. Also you cannot add or combine a generator 
> expression with a value as you would do with 2 + 3 + 4. For example, 
> someone on IRC suggested this
> all(a == 'a' for a in 'apple') but
>
> 1. all is a function/method
> 2. so (whatever) in this case is a call but obviously it works so it must 
> be a generator object as well.. so.. how does 'all' the function object 
> work with the generator object that's being produced? 
>
> I can't for example do min 1,2,3 but i can do min (1,2,3) and the () are 
> not integral to a tuple - therefore one could argue that the () are part 
> of the call - not so with a generator Expression where the () are 
> integral to its existence as an object.
>
> Could someone clarify further.

The Language Reference Manual says:

generator_expression ::=  "(" expression comp_for ")"

The parentheses can be omitted on calls with only one argument. See
section Calls for details.

Calls:

call ::=  primary "(" [argument_list [","] | comprehension] ")"
comprehension ::=  expression comp_for

The last part is the inner part (i.e. without the parentheses) of
generator_expression.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Floating point problem

2020-04-21 Thread Richard Damon
On 4/21/20 9:43 AM, Chris Angelico wrote:
> Right. Now try diagnosing weird bugs in floating-point calculations,
> and you aren't sure if it's because sometimes you have 53 bits of
> mantissa and sometimes only 52.
>
And sometimes only 1. The smallest positive floating point number has
only 1 significant digit (leading 0's are NOT significant), so the
second smallest floating point number is twice that number. The key is
that once you hit the denormals, you no longer have a relative accuracy
like in the normal numbers, but all the denormals have the same absolute
accuracy.

-- 
Richard Damon

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


Python dependences

2020-04-21 Thread jorge . conforte
 

Hi, 

I've already used the python list to clear up some doubts.
It's been about a year since I started using Python in my projects and I
still have some doubts. For those who have always used IDL, this change
is a little difficult. I already have Ptyhon 3.8 installed, on Linux. To
clear up any doubts, what is the best method to install Python
dependencies, for example: numpy, matplolib, netcdf, gdal, etc. Should I
use PIP, conda or install using Conda. What I do so that all
dependencies are installed in the same directory. I installed GDAl and
now I can only use it as root. If you use it as a common user, it always
gives an error message. There is a method that I can uninstall all
dependencies and install them using PIP, so that they are all in the
same directory. This question and that I want to use only Python. And I
already installed some dependencies, and some give me an error message.
For example:

import matplolib

Traceback (most recent call last):

File
 line 1, in 

ModuleNotFoundError: No module named


Excuse me for this long question. And that I want to stop
using IDL and dedicate myself entirely to Python.

Thanks.

Conrado

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


Re: Something annoying about method __set_name__ in descriptors

2020-04-21 Thread Dieter Maurer
ast wrote at 2020-4-21 14:27 +0200:
> From python version 3.6, there is a useful new method
>__set_name__ which could be implemented in descriptors.
>
>This method is called after a descriptor is instantiated
>in a class. Parameter "name" is filled with the name
>of the attribute refering to the descriptor in the class

> ...
>But I discovered that __set_name__ is not called immediately
>after the execution of line "value = Descriptor()" but after
>all class code execution ...

I recently read the Python (3.9a5) documentation - and there
I found clearly expressed this behaviour (I no longer can
tell you exactly where I read this).

The reason comes from the implementation: when the descriptor
is instantiated, the name the instance is bound to is not yet known.
Class creation is complex in Python (details in the Python documentation):
first a so called "namespace" (a mapping from names to values) is constructed;
after this construction, the so called metaclass is called with
class name, bases, the constructed namespace and potentially additional
keyword arguments. It is the typical metaclass (`type`) which calls
`__set_name__` for descritors it finds in the namespace.

This has several ramifications:

 * `__set_name__` is not called "inline" (as you observed)

 * `__set_name__` is not called automatically for descriptors added
   after class construction

 * `__set_name_` may not be called at all if the class uses
   a custom metaclass.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting the dependencies of a function from a library

2020-04-21 Thread Dieter Maurer
elisha hollander wrote at 2020-4-21 00:40 +0300:
>I have a python library with a function.
>This function call some other functions, classes and variable from the
>library (and those functions and classes call other ones, etc)...
>Can I automatically create a file with all of the dependencies (and nothing
>else)?

Have a look at Python's "trace" module.

I have not used it myself (explicitly; but it is likely the
basis of so called (test) coverage tools and those are routinely
applied to code I test).

Apparently, it is not a static analysis tool; i.e. the functions
must be executed to learn which other functions their (concrete) execution
depends upon. Other executions may call other functions.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Dieter Maurer
[email protected] wrote at 2020-4-20 14:48 -0700:
> ...
>I tried telneting the landing page, i.e. without the specific node that 
>requires the login.  So e.g.
>
>Telnet thissite.oh.gov 80
>
>, but it returns a 400 Bad Request.  Before that, the Telnet screen is 
>completely blank ; I have to press a key before it returns the Bad Request.
>
>
>Roger on knowing what the site is asking for.  But I don't know how to 
>determine that.

I use `wget -S` to learn about server responses.
I has the advantage (over `telnet`) to know the HTTP protocl.
-- 
https://mail.python.org/mailman/listinfo/python-list


Announcement: pip 20.1b1 beta release

2020-04-21 Thread Sumana Harihareswara
On behalf of the PyPA, I am pleased to announce that a beta release of 
pip, pip 20.1b1, has been released.


The highlights for this release are:

* Significant speedups when building local directories, by changing 
behavior to perform in-place builds, instead of copying to temporary 
directories.
* Significant speedups in `pip list --outdated`, by parallelizing 
network access. This is the first instance of parallel code within pip's 
codebase.
* A new `pip cache` command, which makes it possible to introspect and 
manage pip's cache directory.
* Better `pip freeze` for packages installed from direct URLs, enabled 
by the implementation of PEP 610.


We would be grateful for all the testing that users could do to ensure 
that, when pip 20.1 is released, it's as solid as we can make it. You 
can upgrade to this beta with `python -m pip install -U --pre pip`.


This release also contains an alpha version of pip's next generation 
resolver. It is **off by default** because it is **unstable and not 
ready for everyday use**. If you're curious about this, please visit 
this GitHub issue about the resolver, what doesn't work yet, and what 
kind of testing would help us out https://github.com/pypa/pip/issues/8099 .


The full changelog is available. https://pip.pypa.io/en/latest/news/

As with all pip releases, a significant amount of the work was 
contributed by pip's user community. Huge thanks to all who have 
contributed, whether through code, documentation, issue reports and/or 
discussion. Your help keeps pip improving, and is hugely appreciated.


Specific thanks go to Mozilla (through its Mozilla Open Source Support 
Awards) and to the Chan Zuckerberg Initiative DAF, an advised fund of 
Silicon Valley Community Foundation, for their support that enabled the 
work on the new resolver.



--
Sumana Harihareswara
pip project manager under contract with Python Software Foundation
Changeset Consulting
https://changeset.nyc
--
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread dcwhatthe
On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
> dc wrote at 2020-4-20 14:48 -0700:
> > ...
> >I tried telneting the landing page, i.e. without the specific node that 
> >requires the login.  So e.g.
> >
> >Telnet thissite.oh.gov 80
> >
> >, but it returns a 400 Bad Request.  Before that, the Telnet screen is 
> >completely blank ; I have to press a key before it returns the Bad Request.
> >
> >
> >Roger on knowing what the site is asking for.  But I don't know how to 
> >determine that.
> 
> I use `wget -S` to learn about server responses.
> I has the advantage (over `telnet`) to know the HTTP protocl.

Sure enough, wget DOES return a lot of information.  In fact, although an 
initial response of 401 is returned, it waits for the response and finally 
returns a 200.

So, I guess the question finally comes down to:  How do we make the 
requests.get() wait for a response?  The timeout value isn't the same thing 
that I thought it was.  So how do we tell .get() to wait 20 or 30 seconds for 
an OK response?

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


python and numpy

2020-04-21 Thread Derek Vladescu via Python-list
I’ve just begun a serious study of using Python as an aspiring programmer/data 
scientist.
Can someone please walk me through how to download Python, SO THAT I will be 
able to import numpy?

Thanks,
Derek

Sent from Mail for Windows 10

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


Re: Python dependences

2020-04-21 Thread Juergen Brendel


Hello!

I always use 'pip', but I heard many people like 'conda'. So far I'm
doing ok with 'pip' and many/most instructions or documentation just
refers to that as well. Still seems to be the most standard way of
installing Python dependencies.

The trick is to always create a nice virtual environment for your
Python project. Then, once you are in that virt-env, you run 'pip' as a
normal user (not sudo!) and everything is only installed within that
environment.

Personally, I like virtualenvwrapper:

   https://virtualenvwrapper.readthedocs.io/en/latest/

 * Each virt-env can have a different Python interpreter/version.
 * Easy switching between virt-envs. Just type "workon "
 * You can always jump to the directory in which all the installed
   dependencies are. Just type "cdsitepackages"
 * Jump back to where your sources are: "cdproject"
 * Completely wipe all installed dependencies of the virt-env with a
   single command: "wipeenv"

It really makes it easy working with many different Python projects.

Juergen



On Tue, 2020-04-21 at 11:35 -0300, [email protected] wrote:
>  
> 
> Hi, 
> 
> I've already used the python list to clear up some doubts.
> It's been about a year since I started using Python in my projects
> and I
> still have some doubts. For those who have always used IDL, this
> change
> is a little difficult. I already have Ptyhon 3.8 installed, on Linux.
> To
> clear up any doubts, what is the best method to install Python
> dependencies, for example: numpy, matplolib, netcdf, gdal, etc.
> Should I
> use PIP, conda or install using Conda. What I do so that all
> dependencies are installed in the same directory. I installed GDAl
> and
> now I can only use it as root. If you use it as a common user, it
> always
> gives an error message. There is a method that I can uninstall all
> dependencies and install them using PIP, so that they are all in the
> same directory. This question and that I want to use only Python. And
> I
> already installed some dependencies, and some give me an error
> message.
> For example:
> 
> import matplolib
> 
> Traceback (most recent call last):
> 
> File
>  line 1, in 
> 
> ModuleNotFoundError: No module named
> 
> 
> Excuse me for this long question. And that I want to stop
> using IDL and dedicate myself entirely to Python.
> 
> Thanks.
> 
> Conrado
> 
>  

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


Re: Python dependences

2020-04-21 Thread Grant Edwards
On 2020-04-21, [email protected]  wrote:

> I've already used the python list to clear up some doubts.  It's
> been about a year since I started using Python in my projects and I
> still have some doubts. For those who have always used IDL, this
> change is a little difficult. I already have Ptyhon 3.8 installed,
> on Linux. To clear up any doubts, what is the best method to install
> Python dependencies, for example: numpy, matplolib, netcdf, gdal,
> etc. Should I use PIP, conda or install using Conda.

Ideally, none of the above.  Use the packaging system your
distribution uses for everything else.  On most Linux systems
installing lots of stuff "outside" the normal package system results
in headaches...

--
Grant


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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Barry Scott



> On 21 Apr 2020, at 18:11, [email protected] wrote:
> 
> On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
>> dc wrote at 2020-4-20 14:48 -0700:
>>> ...
>>> I tried telneting the landing page, i.e. without the specific node that 
>>> requires the login.  So e.g.
>>> 
>>> Telnet thissite.oh.gov 80
>>> 
>>> , but it returns a 400 Bad Request.  Before that, the Telnet screen is 
>>> completely blank ; I have to press a key before it returns the Bad Request.
>>> 
>>> 
>>> Roger on knowing what the site is asking for.  But I don't know how to 
>>> determine that.
>> 
>> I use `wget -S` to learn about server responses.
>> I has the advantage (over `telnet`) to know the HTTP protocl.
> 
> Sure enough, wget DOES return a lot of information.  In fact, although an 
> initial response of 401 is returned, it waits for the response and finally 
> returns a 200.
> 
> So, I guess the question finally comes down to:  How do we make the 
> requests.get() wait for a response?  The timeout value isn't the same thing 
> that I thought it was.  So how do we tell .get() to wait 20 or 30 seconds for 
> an OK response?

The way HTTP protocol works is that you send a request and get a response. 1 in 
1 out.
The response can tell you that you need to do more work, like add 
authentication data.

The only use of the timeout is to allow you to give up if a response does not 
comeback
before you get bored waiting.

In the case of the 401 you can read what it means here: 
https://httpstatuses.com/401

It is then up to your code to issue a new request with the requirer 
authentication headers.
The headers you got back in the first response will tell you what type of 
authentication is requires,
basic, digest etc.

The library you are using should be able to handle this if you provide what the 
library requires from
you to do the authenticate.

Personally I debug stuff using the curl command. curl -v  shows you the 
request and the response.
You can then add curl options to provide authenicate data (username/password) 
and how to use it --basic
and --digest for example.

Oh and the other status that needs handling is a 302 redirect. This allows a 
web site to more a page
and tell you the new location. Again you have to allow your library to do this 
for you.

Barry



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

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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread dcwhatthe
On Tuesday, April 21, 2020 at 3:16:51 PM UTC-4, Barry Scott wrote:
> > On 21 Apr 2020, at 18:11, dc wrote:
> > 
> > On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
> >> dc wrote at 2020-4-20 14:48 -0700:
> >>> ...
> >>> I tried telneting the landing page, i.e. without the specific node that 
> >>> requires the login.  So e.g.
> >>> 
> >>> Telnet thissite.oh.gov 80
> >>> 
> >>> , but it returns a 400 Bad Request.  Before that, the Telnet screen is 
> >>> completely blank ; I have to press a key before it returns the Bad 
> >>> Request.
> >>> 
> >>> 
> >>> Roger on knowing what the site is asking for.  But I don't know how to 
> >>> determine that.
> >> 
> >> I use `wget -S` to learn about server responses.
> >> I has the advantage (over `telnet`) to know the HTTP protocl.
> > 
> > Sure enough, wget DOES return a lot of information.  In fact, although an 
> > initial response of 401 is returned, it waits for the response and finally 
> > returns a 200.
> > 
> > So, I guess the question finally comes down to:  How do we make the 
> > requests.get() wait for a response?  The timeout value isn't the same thing 
> > that I thought it was.  So how do we tell .get() to wait 20 or 30 seconds 
> > for an OK response?
> 
> The way HTTP protocol works is that you send a request and get a response. 1 
> in 1 out.
> The response can tell you that you need to do more work, like add 
> authentication data.
> 
> The only use of the timeout is to allow you to give up if a response does not 
> comeback
> before you get bored waiting.
> 
> In the case of the 401 you can read what it means here: 
> https://httpstatuses.com/401
> 
> It is then up to your code to issue a new request with the requirer 
> authentication headers.
> The headers you got back in the first response will tell you what type of 
> authentication is requires,
> basic, digest etc.
> 
> The library you are using should be able to handle this if you provide what 
> the library requires from
> you to do the authenticate.
> 
> Personally I debug stuff using the curl command. curl -v  shows you the 
> request and the response.
> You can then add curl options to provide authenicate data (username/password) 
> and how to use it --basic
> and --digest for example.
> 
> Oh and the other status that needs handling is a 302 redirect. This allows a 
> web site to more a page
> and tell you the new location. Again you have to allow your library to do 
> this for you.
> 
> Barry
> 
> 
> 
> > 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list
> >

Barry, Thanks.  I'm starting to get a bigger picture, now.

So I really do need to raise the status, in order to get the headers  I had put 
this in orginally, but then thought it wasn't necessary.

So in the case of this particular site, if I understand correctly, I would be 
using the NTLM to decide which type of Authentication to follow up with (I 
think).

Content-Length:  1293
Content-Type:text/html
WWW-Authenticate:Negotiate, NTLM

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


Re: Getting the dependencies of a function from a library

2020-04-21 Thread Barry Scott



> On 20 Apr 2020, at 22:40, elisha hollander  wrote:
> 
> I have a python library with a function.
> This function call some other functions, classes and variable from the
> library (and those functions and classes call other ones, etc)...
> Can I automatically create a file with all of the dependencies (and nothing
> else)?
> (Already posted on stack overflow with no answer)

Are you after code coverage? Try this https://pypi.org/project/coverage/ 

Then there is cProfile, part of python stdlib, that shows what was run and how 
often.

Barry

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


Re: Why is a generator expression called a expression?

2020-04-21 Thread Barry Scott



> On 20 Apr 2020, at 10:29, Veek M  wrote:
> 
> On Mon, 20 Apr 2020 19:19:31 +1000, Chris Angelico wrote:
> 
>> In the case of a genexp, the expression has a value which is a generator
>> object. When you pass that to all(), it takes it and then iterates over
> 
> but an object is NOT THE SAME as it's value! '2' is an object which 
> happens to have a value of 2 under certain contexts.. ergo a generator 
> object is returned by ( whatever ) and therefore NOT a value-to-be-used!

In computer software there are lots of objects that are not simple things
like the integer 2. All of these objects can be values and are called values.

A value is not limited to only being integers for example.

Barry



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

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


Re: Why is a generator expression called a expression?

2020-04-21 Thread Chris Angelico
On Wed, Apr 22, 2020 at 6:12 AM Barry Scott  wrote:
>
>
>
> > On 20 Apr 2020, at 10:29, Veek M  wrote:
> >
> > On Mon, 20 Apr 2020 19:19:31 +1000, Chris Angelico wrote:
> >
> >> In the case of a genexp, the expression has a value which is a generator
> >> object. When you pass that to all(), it takes it and then iterates over
> >
> > but an object is NOT THE SAME as it's value! '2' is an object which
> > happens to have a value of 2 under certain contexts.. ergo a generator
> > object is returned by ( whatever ) and therefore NOT a value-to-be-used!
>
> In computer software there are lots of objects that are not simple things
> like the integer 2. All of these objects can be values and are called values.
>
> A value is not limited to only being integers for example.

In fact, languages like Python strengthen that: not only *can* all
objects be values, but they inherently *are* values. Everything that
can be put into a variable is a value, and that includes functions,
strings, bound methods, dictionaries, modules, types (classes), the
lot. Everything is an object and everything is a value.

It takes some getting-your-head-around, but it is immensely powerful
and convenient!

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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Barry Scott



> On 21 Apr 2020, at 20:47, [email protected] wrote:
> 
> On Tuesday, April 21, 2020 at 3:16:51 PM UTC-4, Barry Scott wrote:
>>> On 21 Apr 2020, at 18:11, dc wrote:
>>> 
>>> On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
 dc wrote at 2020-4-20 14:48 -0700:
> ...
> I tried telneting the landing page, i.e. without the specific node that 
> requires the login.  So e.g.
> 
> Telnet thissite.oh.gov 80
> 
> , but it returns a 400 Bad Request.  Before that, the Telnet screen is 
> completely blank ; I have to press a key before it returns the Bad 
> Request.
> 
> 
> Roger on knowing what the site is asking for.  But I don't know how to 
> determine that.
 
 I use `wget -S` to learn about server responses.
 I has the advantage (over `telnet`) to know the HTTP protocl.
>>> 
>>> Sure enough, wget DOES return a lot of information.  In fact, although an 
>>> initial response of 401 is returned, it waits for the response and finally 
>>> returns a 200.
>>> 
>>> So, I guess the question finally comes down to:  How do we make the 
>>> requests.get() wait for a response?  The timeout value isn't the same thing 
>>> that I thought it was.  So how do we tell .get() to wait 20 or 30 seconds 
>>> for an OK response?
>> 
>> The way HTTP protocol works is that you send a request and get a response. 1 
>> in 1 out.
>> The response can tell you that you need to do more work, like add 
>> authentication data.
>> 
>> The only use of the timeout is to allow you to give up if a response does 
>> not comeback
>> before you get bored waiting.
>> 
>> In the case of the 401 you can read what it means here: 
>> https://httpstatuses.com/401
>> 
>> It is then up to your code to issue a new request with the requirer 
>> authentication headers.
>> The headers you got back in the first response will tell you what type of 
>> authentication is requires,
>> basic, digest etc.
>> 
>> The library you are using should be able to handle this if you provide what 
>> the library requires from
>> you to do the authenticate.
>> 
>> Personally I debug stuff using the curl command. curl -v  shows you the 
>> request and the response.
>> You can then add curl options to provide authenicate data 
>> (username/password) and how to use it --basic
>> and --digest for example.
>> 
>> Oh and the other status that needs handling is a 302 redirect. This allows a 
>> web site to more a page
>> and tell you the new location. Again you have to allow your library to do 
>> this for you.
>> 
>> Barry
>> 
>> 
>> 
>>> 
>>> -- 
>>> https://mail.python.org/mailman/listinfo/python-list
>>> 
> 
> Barry, Thanks.  I'm starting to get a bigger picture, now.
> 
> So I really do need to raise the status, in order to get the headers  I had 
> put this in orginally, but then thought it wasn't necessary.

In a response you always get a status line, headers and a body. In case of a 
response that is not a 200 there is often
important information in the headers. The body is usually for showing to humans 
when the program does not know
how to handle the status code.

> 
> So in the case of this particular site, if I understand correctly, I would be 
> using the NTLM to decide which type of Authentication to follow up with (I 
> think).
> 
> Content-Length:  1293
> Content-Type:text/html
> WWW-Authenticate:Negotiate, NTLM

Yep that is right. The site wants you to use NTLM to authenticate with it.
NTLM is not always supported, you will need to check your library docs to see 
if it supports NTLM.

Barry




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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Chris Angelico
On Wed, Apr 22, 2020 at 6:30 AM Barry Scott  wrote:
>
>
>
> > On 21 Apr 2020, at 20:47, [email protected] wrote:
> >
> > On Tuesday, April 21, 2020 at 3:16:51 PM UTC-4, Barry Scott wrote:
> >>> On 21 Apr 2020, at 18:11, dc wrote:
> >>>
> >>> On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
>  dc wrote at 2020-4-20 14:48 -0700:
> > ...
> > I tried telneting the landing page, i.e. without the specific node that 
> > requires the login.  So e.g.
> >
> > Telnet thissite.oh.gov 80
> >
> > , but it returns a 400 Bad Request.  Before that, the Telnet screen is 
> > completely blank ; I have to press a key before it returns the Bad 
> > Request.
> >
> >
> > Roger on knowing what the site is asking for.  But I don't know how to 
> > determine that.
> 
>  I use `wget -S` to learn about server responses.
>  I has the advantage (over `telnet`) to know the HTTP protocl.
> >>>
> >>> Sure enough, wget DOES return a lot of information.  In fact, although an 
> >>> initial response of 401 is returned, it waits for the response and 
> >>> finally returns a 200.
> >>>
> >>> So, I guess the question finally comes down to:  How do we make the 
> >>> requests.get() wait for a response?  The timeout value isn't the same 
> >>> thing that I thought it was.  So how do we tell .get() to wait 20 or 30 
> >>> seconds for an OK response?
> >>
> >> The way HTTP protocol works is that you send a request and get a response. 
> >> 1 in 1 out.
> >> The response can tell you that you need to do more work, like add 
> >> authentication data.
> >>
> >> The only use of the timeout is to allow you to give up if a response does 
> >> not comeback
> >> before you get bored waiting.
> >>
> >> In the case of the 401 you can read what it means here: 
> >> https://httpstatuses.com/401
> >>
> >> It is then up to your code to issue a new request with the requirer 
> >> authentication headers.
> >> The headers you got back in the first response will tell you what type of 
> >> authentication is requires,
> >> basic, digest etc.
> >>
> >> The library you are using should be able to handle this if you provide 
> >> what the library requires from
> >> you to do the authenticate.
> >>
> >> Personally I debug stuff using the curl command. curl -v  shows you 
> >> the request and the response.
> >> You can then add curl options to provide authenicate data 
> >> (username/password) and how to use it --basic
> >> and --digest for example.
> >>
> >> Oh and the other status that needs handling is a 302 redirect. This allows 
> >> a web site to more a page
> >> and tell you the new location. Again you have to allow your library to do 
> >> this for you.
> >>
> >> Barry
> >>
> >>
> >>
> >>>
> >>> --
> >>> https://mail.python.org/mailman/listinfo/python-list
> >>>
> >
> > Barry, Thanks.  I'm starting to get a bigger picture, now.
> >
> > So I really do need to raise the status, in order to get the headers  I had 
> > put this in orginally, but then thought it wasn't necessary.
>
> In a response you always get a status line, headers and a body. In case of a 
> response that is not a 200 there is often
> important information in the headers. The body is usually for showing to 
> humans when the program does not know
> how to handle the status code.
>
> >
> > So in the case of this particular site, if I understand correctly, I would 
> > be using the NTLM to decide which type of Authentication to follow up with 
> > (I think).
> >
> > Content-Length:  1293
> > Content-Type:text/html
> > WWW-Authenticate:Negotiate, NTLM
>
> Yep that is right. The site wants you to use NTLM to authenticate with it.
> NTLM is not always supported, you will need to check your library docs to see 
> if it supports NTLM.
>

I believe the 'requests' library supports NTLM, although I haven't
personally used it so I can't check.

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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread dcwhatthe
On Tuesday, April 21, 2020 at 4:25:54 PM UTC-4, Barry Scott wrote:
> > On 21 Apr 2020, at 20:47, dc wrote:
> > 
> > On Tuesday, April 21, 2020 at 3:16:51 PM UTC-4, Barry Scott wrote:
> >>> On 21 Apr 2020, at 18:11, dc wrote:
> >>> 
> >>> On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
>  dc wrote at 2020-4-20 14:48 -0700:
> > ...
> > I tried telneting the landing page, i.e. without the specific node that 
> > requires the login.  So e.g.
> > 
> > Telnet thissite.oh.gov 80
> > 
> > , but it returns a 400 Bad Request.  Before that, the Telnet screen is 
> > completely blank ; I have to press a key before it returns the Bad 
> > Request.
> > 
> > 
> > Roger on knowing what the site is asking for.  But I don't know how to 
> > determine that.
>  
>  I use `wget -S` to learn about server responses.
>  I has the advantage (over `telnet`) to know the HTTP protocl.
> >>> 
> >>> Sure enough, wget DOES return a lot of information.  In fact, although an 
> >>> initial response of 401 is returned, it waits for the response and 
> >>> finally returns a 200.
> >>> 
> >>> So, I guess the question finally comes down to:  How do we make the 
> >>> requests.get() wait for a response?  The timeout value isn't the same 
> >>> thing that I thought it was.  So how do we tell .get() to wait 20 or 30 
> >>> seconds for an OK response?
> >> 
> >> The way HTTP protocol works is that you send a request and get a response. 
> >> 1 in 1 out.
> >> The response can tell you that you need to do more work, like add 
> >> authentication data.
> >> 
> >> The only use of the timeout is to allow you to give up if a response does 
> >> not comeback
> >> before you get bored waiting.
> >> 
> >> In the case of the 401 you can read what it means here: 
> >> https://httpstatuses.com/401
> >> 
> >> It is then up to your code to issue a new request with the requirer 
> >> authentication headers.
> >> The headers you got back in the first response will tell you what type of 
> >> authentication is requires,
> >> basic, digest etc.
> >> 
> >> The library you are using should be able to handle this if you provide 
> >> what the library requires from
> >> you to do the authenticate.
> >> 
> >> Personally I debug stuff using the curl command. curl -v  shows you 
> >> the request and the response.
> >> You can then add curl options to provide authenicate data 
> >> (username/password) and how to use it --basic
> >> and --digest for example.
> >> 
> >> Oh and the other status that needs handling is a 302 redirect. This allows 
> >> a web site to more a page
> >> and tell you the new location. Again you have to allow your library to do 
> >> this for you.
> >> 
> >> Barry
> >> 
> >> 
> >> 
> >>> 
> >>> -- 
> >>> https://mail.python.org/mailman/listinfo/python-list
> >>> 
> > 
> > Barry, Thanks.  I'm starting to get a bigger picture, now.
> > 
> > So I really do need to raise the status, in order to get the headers  I had 
> > put this in orginally, but then thought it wasn't necessary.
> 
> In a response you always get a status line, headers and a body. In case of a 
> response that is not a 200 there is often
> important information in the headers. The body is usually for showing to 
> humans when the program does not know
> how to handle the status code.
> 
> > 
> > So in the case of this particular site, if I understand correctly, I would 
> > be using the NTLM to decide which type of Authentication to follow up with 
> > (I think).
> > 
> > Content-Length:  1293
> > Content-Type:text/html
> > WWW-Authenticate:Negotiate, NTLM
> 
> Yep that is right. The site wants you to use NTLM to authenticate with it.
> NTLM is not always supported, you will need to check your library docs to see 
> if it supports NTLM.
> 
> Barry
> 
> 
> 
> 
> > 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list 
> > 

I'm pretty much there ; just have to account for other types of Authentication. 
 E.g., for NTLM, I have this:

response.raise_for_status
headers : list = response.headers
type_of_authentication_s : str = headers[ 'WWW-Authenticate' ]
if response_status_code == 401 and 'NTLM' in 
type_of_authentication_s:
response = requests.get(ip_s, auth=HttpNtlmAuth(user_id_s,pw_s 
) )
response_status_code: int = response.status_code


I can take it from here.  Thanks much for your help, sir.


Regards,

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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread dcwhatthe
On Tuesday, April 21, 2020 at 4:38:52 PM UTC-4, Chris Angelico wrote:
> On Wed, Apr 22, 2020 at 6:30 AM Barry Scott barr wrote:
> >
> >
> >
> > > On 21 Apr 2020, at 20:47, dc wrote:
> > >
> > > On Tuesday, April 21, 2020 at 3:16:51 PM UTC-4, Barry Scott wrote:
> > >>> On 21 Apr 2020, at 18:11, dc wrote:
> > >>>
> > >>> On Tuesday, April 21, 2020 at 12:40:25 PM UTC-4, Dieter Maurer wrote:
> >  dc wrote at 2020-4-20 14:48 -0700:
> > > ...
> > > I tried telneting the landing page, i.e. without the specific node 
> > > that requires the login.  So e.g.
> > >
> > > Telnet thissite.oh.gov 80
> > >
> > > , but it returns a 400 Bad Request.  Before that, the Telnet screen 
> > > is completely blank ; I have to press a key before it returns the Bad 
> > > Request.
> > >
> > >
> > > Roger on knowing what the site is asking for.  But I don't know how 
> > > to determine that.
> > 
> >  I use `wget -S` to learn about server responses.
> >  I has the advantage (over `telnet`) to know the HTTP protocl.
> > >>>
> > >>> Sure enough, wget DOES return a lot of information.  In fact, although 
> > >>> an initial response of 401 is returned, it waits for the response and 
> > >>> finally returns a 200.
> > >>>
> > >>> So, I guess the question finally comes down to:  How do we make the 
> > >>> requests.get() wait for a response?  The timeout value isn't the same 
> > >>> thing that I thought it was.  So how do we tell .get() to wait 20 or 30 
> > >>> seconds for an OK response?
> > >>
> > >> The way HTTP protocol works is that you send a request and get a 
> > >> response. 1 in 1 out.
> > >> The response can tell you that you need to do more work, like add 
> > >> authentication data.
> > >>
> > >> The only use of the timeout is to allow you to give up if a response 
> > >> does not comeback
> > >> before you get bored waiting.
> > >>
> > >> In the case of the 401 you can read what it means here: 
> > >> https://httpstatuses.com/401
> > >>
> > >> It is then up to your code to issue a new request with the requirer 
> > >> authentication headers.
> > >> The headers you got back in the first response will tell you what type 
> > >> of authentication is requires,
> > >> basic, digest etc.
> > >>
> > >> The library you are using should be able to handle this if you provide 
> > >> what the library requires from
> > >> you to do the authenticate.
> > >>
> > >> Personally I debug stuff using the curl command. curl -v  shows you 
> > >> the request and the response.
> > >> You can then add curl options to provide authenicate data 
> > >> (username/password) and how to use it --basic
> > >> and --digest for example.
> > >>
> > >> Oh and the other status that needs handling is a 302 redirect. This 
> > >> allows a web site to more a page
> > >> and tell you the new location. Again you have to allow your library to 
> > >> do this for you.
> > >>
> > >> Barry
> > >>
> > >>
> > >>
> > >>>
> > >>> --
> > >>> https://mail.python.org/mailman/listinfo/python-list
> > >>>
> > >
> > > Barry, Thanks.  I'm starting to get a bigger picture, now.
> > >
> > > So I really do need to raise the status, in order to get the headers  I 
> > > had put this in orginally, but then thought it wasn't necessary.
> >
> > In a response you always get a status line, headers and a body. In case of 
> > a response that is not a 200 there is often
> > important information in the headers. The body is usually for showing to 
> > humans when the program does not know
> > how to handle the status code.
> >
> > >
> > > So in the case of this particular site, if I understand correctly, I 
> > > would be using the NTLM to decide which type of Authentication to follow 
> > > up with (I think).
> > >
> > > Content-Length:  1293
> > > Content-Type:text/html
> > > WWW-Authenticate:Negotiate, NTLM
> >
> > Yep that is right. The site wants you to use NTLM to authenticate with it.
> > NTLM is not always supported, you will need to check your library docs to 
> > see if it supports NTLM.
> >
> 
> I believe the 'requests' library supports NTLM, although I haven't
> personally used it so I can't check.
> 
> ChrisA

In this case, I used the requests_ntlm import:

from requests_ntlm import HttpNtlmAuth

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


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Chris Angelico
On Wed, Apr 22, 2020 at 6:51 AM  wrote:
>
> I'm pretty much there ; just have to account for other types of 
> Authentication.  E.g., for NTLM, I have this:
>
> response.raise_for_status

Be aware that this line of code won't actually do anything. That's a method.

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


Re: python and numpy

2020-04-21 Thread Souvik Dutta
First head over to the official python download page. Then choose the
version and type of installer you want. After you download it click on the
installer to install it. Don't forget to click on the check boxes that says
add python to path and download pip. Then search for idle in the search
menu. This is applicable for windows and Mac. I don't know for Linux.
https://www.python.org/downloads/
This is the official python website.
Thank you
Souvik flutter dev

On Wed, Apr 22, 2020, 12:34 AM Derek Vladescu via Python-list <
[email protected]> wrote:

> I’ve just begun a serious study of using Python as an aspiring
> programmer/data scientist.
> Can someone please walk me through how to download Python, SO THAT I will
> be able to import numpy?
>
> Thanks,
> Derek
>
> Sent from Mail for Windows 10
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Something annoying about method __set_name__ in descriptors

2020-04-21 Thread ast

Le 21/04/2020 à 18:32, Dieter Maurer a écrit :

ast wrote at 2020-4-21 14:27 +0200:




I recently read the Python (3.9a5) documentation - and there
I found clearly expressed this behaviour (I no longer can
tell you exactly where I read this).

The reason comes from the implementation: when the descriptor
is instantiated, the name the instance is bound to is not yet known.
Class creation is complex in Python (details in the Python documentation):
first a so called "namespace" (a mapping from names to values) is constructed;
after this construction, the so called metaclass is called with
class name, bases, the constructed namespace and potentially additional
keyword arguments. It is the typical metaclass (`type`) which calls
`__set_name__` for descritors it finds in the namespace.

This has several ramifications:

  * `__set_name__` is not called "inline" (as you observed)

  * `__set_name__` is not called automatically for descriptors added
after class construction

  * `__set_name_` may not be called at all if the class uses
a custom metaclass.



Thank you for this explanation.
So it's not a bug it's a feature
--
https://mail.python.org/mailman/listinfo/python-list


Re: Escaping confusion with Python 3 + MySQL

2020-04-21 Thread moorthy . rs
On Sunday, March 26, 2017 at 7:55:09 PM UTC+5:30, Νίκος Βέργος wrote:
> Τη Κυριακή, 26 Μαρτίου 2017 - 5:19:27 μ.μ. UTC+3, ο χρήστης Ian έγραψε:
> 
> > You need to change the placeholders back. The poster who told you to
> > replace them was misinformed.
> 
> okey altered them back to
> 
> cur.execute('''UPDATE visitors SET (pagesID, host, ref, location, useros, 
> browser, visits) VALUES (%s, %s, %s, %s, %s, %s, %s) WHERE host LIKE "%%s%" 
> ''', 
>   
>   
>   
> (pID, domain, ref, location, 
> useros, browser, lastvisit, domain) )
> 
> but now the problem is how to exact;y type the Where HOST like "%%%"
> 
> I MEAN HOW TO DIFFERENTIATE '%S' FROM LITERAL '%' character.

Hi ,

I have fixed this issue on other way 

you can declare variables like below and pass same to the query with strings.

per1="%%%"

you can assign this string (WHERE host LIKE "%%s%" ,per1) to avoid this issue.

same way i resolved my query execution on cursor execute.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: python and numpy

2020-04-21 Thread joseph pareti
FWIW, I installed Anaconda on Windows 10. Then besides Python you also get
SPIDER, Jupyter and more, all out of the box.

Am Mittwoch, 22. April 2020 schrieb Souvik Dutta :

> First head over to the official python download page. Then choose the
> version and type of installer you want. After you download it click on the
> installer to install it. Don't forget to click on the check boxes that says
> add python to path and download pip. Then search for idle in the search
> menu. This is applicable for windows and Mac. I don't know for Linux.
> https://www.python.org/downloads/
> This is the official python website.
> Thank you
> Souvik flutter dev
>
> On Wed, Apr 22, 2020, 12:34 AM Derek Vladescu via Python-list <
> [email protected]> wrote:
>
> > I’ve just begun a serious study of using Python as an aspiring
> > programmer/data scientist.
> > Can someone please walk me through how to download Python, SO THAT I will
> > be able to import numpy?
> >
> > Thanks,
> > Derek
> >
> > Sent from Mail for Windows 10
> >
> > --
> > https://mail.python.org/mailman/listinfo/python-list
> >
> --
> https://mail.python.org/mailman/listinfo/python-list
>


-- 
Regards,
Joseph Pareti - Artificial Intelligence consultant
Joseph Pareti's AI Consulting Services
https://www.joepareti54-ai.com/
cell +49 1520 1600 209
cell +39 339 797 0644
-- 
https://mail.python.org/mailman/listinfo/python-list


news.bbs.nz is spewing duplicates to comp.lang.python

2020-04-21 Thread Eli the Bearded
This just arrived at my newserver:

Path: 
reader2.panix.com!panix!goblin2!goblin.stu.neva.ru!news.unit0.net!2.eu.feeder.erje.net!4.us.feeder.erje.net!feeder.erje.net!xmission!csiph.com!news.bbs.nz!.POSTED.agency.bbs.nz!not-for-mail
From: Eli the Bearded <*@eli.users.panix.com> (Eli the Bearded)
Newsgroups: comp.lang.python
Subject: Re: Getting a 401 from requests.get, but not when logging in via 
the br
Date: Mon, 20 Apr 2020 19:18:48 +1200
Organization: fsxNet Usenet Gateway | bbs.nz/#fsxNet
Message-ID: <[email protected]>
References: <[email protected]>
Mime-Version: 1.0
Content-Type: text/plain; charset=us-ascii
Content-Transfer-Encoding: 7bit
Injection-Info: news.bbs.nz; 
posting-host="8IWYKlztXHa0+IViEdY46zrq8kpk7dC9fTbT74JiSDQ";
logging-data="12595"; mail-complaints-to="[email protected]"
User-Agent: VSoup v1.2.9.47Beta [95/NT]
X-Comment-To: dcwhatthe
X-MailConverter: SoupGate-Win32 v1.05
Lines: 36

I find that very curious because the post is mine but which I
sent out with these headers:

Path: reader2.panix.com!panix!qz!not-for-mail
From: Eli the Bearded <*@eli.users.panix.com>
Newsgroups: comp.lang.python
Subject: Re: Getting a 401 from requests.get, but not when logging in via 
the browser.
Date: Mon, 20 Apr 2020 19:18:48 + (UTC)
Organization: Some absurd concept
Lines: 37
Message-ID: 
References: <[email protected]>
NNTP-Posting-Host: panix5.panix.com
X-Trace: reader2.panix.com 1587410328 23363 166.84.1.5 (20 Apr 2020 
19:18:48 GMT)
X-Complaints-To: [email protected]
NNTP-Posting-Date: Mon, 20 Apr 2020 19:18:48 + (UTC)
X-Liz: It's actually happened, the entire Internet is a massive game of 
Redcode
X-Motto: "Erosion of rights never seems to reverse itself." -- kenny@panix
X-US-Congress: Moronic Fucks.
X-Attribution: EtB
XFrom: is a real address
Encrypted: double rot-13
User-Agent: Vectrex rn 2.1 (beta)

The timezone on the date header has changed, the subject has been
truncated, the Path and injection info is all different, and most
crucially, the MESSAGE-ID and REFERENCES are completely bogus.
News servers rely on Message-ID to tell if a message is unique. Change
it, and it is now a new message. Screwing up References: header while
changing the Subject: is going to break news threading.

The newsgroup is almost not worth the effort with all the breakage that
happens here.

Elijah
--
other breakage happens with References: headers due to mailing list stuff
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Getting a 401 from requests.get, but not when logging in via the browser.

2020-04-21 Thread Chris Angelico
On Wed, Apr 22, 2020 at 5:18 AM Barry Scott  wrote:
> In the case of the 401 you can read what it means here: 
> https://httpstatuses.com/401
>

Or for a less technical (and far cuter) explanation: https://http.cat/401

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