Re: [Tutor] SSL Error

2018-07-31 Thread Marc Tompkins
This is a general Python tutor group; I'm not sure anybody here can help
you with the OpenSSL package (I've definitely never used it myself.)  We're
all willing to help, but this might not be the right place to ask this
question.

More to the point, though, when you ask questions on this list it's best to
just cut and paste BOTH your code and the actual error message/traceback;
from the bit that you've posted, it sounds like it might be as simple as a
typo, but we can't really tell without seeing your code.

On Mon, Jul 30, 2018 at 7:52 PM, Saket Mehrotra 
wrote:

> Hi
>
> I am trying to run import requests in a py file but I am getting below
> error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'
> >>>
>
> I tried to execute below from the terminal but it still remains unresolved.
>
> sudo easy_install --upgrade pip
>
> I've also had to run:
>
> sudo pip uninstall pyopenssl
>
> sudo pip install mozdownload
>
>
> Can you please help me .
>
> Thanks & Regards
> Saket Mehrotra
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-07-31 Thread Alan Gauld via Tutor
On 31/07/18 03:52, Saket Mehrotra wrote:

> error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'

Are you sure you spelled the attribute correctly?

Have you tried


>>> import ssl
>>> dir(ssl)

Top see what the attribute names look like?
Is PROTOCOL_SSLv23 one of them?


-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-07-31 Thread Zachary Ware
On Tue, Jul 31, 2018 at 12:06 PM Alan Gauld via Tutor  wrote:
>
> On 31/07/18 03:52, Saket Mehrotra wrote:
>
> > error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> > AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'
>
> Are you sure you spelled the attribute correctly?
>
> Have you tried
>
>
> >>> import ssl
> >>> dir(ssl)
>
> Top see what the attribute names look like?
> Is PROTOCOL_SSLv23 one of them?

Also check `ssl.__file__` and make sure it is the standard library's
`ssl.py` (/usr/lib/python3.6/ssl.py or similar) and not a local file
of yours named `ssl.py`.

-- 
Zach
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-07-31 Thread Marc Tompkins
On Tue, Jul 31, 2018 at 10:03 AM, Alan Gauld via Tutor 
wrote:

> On 31/07/18 03:52, Saket Mehrotra wrote:
>
> > error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> > AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'
>
> Are you sure you spelled the attribute correctly?
>
> Have you tried
>
>
> >>> import ssl
> >>> dir(ssl)
>
> Top see what the attribute names look like?
> Is PROTOCOL_SSLv23 one of them?
>
> What I was getting at earlier: it isn't clear, without seeing his code,
whether he's directly asking for PROTOCOL_SSLv23, or whether it's an
internal result of a call he made.  If it's the first, then the problem is
with his code; if it's the second, it's a problem with how the package is
built on his machine.  Really can't tell without context.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-07-31 Thread Peter Otten
Saket Mehrotra wrote:

> Hi
> 
> I am trying to run import requests in a py file but I am getting below
> error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
> AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'

If you start the Python interpreter and execute

>>> import ssl
>>> ssl.__file__
'/usr/lib/python3.4/ssl.py'

does it print something suspicious? You might be hiding the standard ssl.py 
with one you created yourself:

# touch ssl.py
$ python3
Python 3.4.3 (default, Nov 28 2017, 16:41:13) 
[GCC 4.8.4] on linux
Type "help", "copyright", "credits" or "license" for more information.
>>> import ssl
>>> ssl.__file__
'/home/peter/mystuff/ssl.py'

In that case just rename the offending file (if you are using Python 2 
remember to remove the corresponding ssl.pyc).


> 
> I tried to execute below from the terminal but it still remains
> unresolved.
> 
> sudo easy_install --upgrade pip
> 
> I've also had to run:
> 
> sudo pip uninstall pyopenssl
> 
> sudo pip install mozdownload
> 
> 
> Can you please help me .
> 
> Thanks & Regards
> Saket Mehrotra
> ___
> Tutor maillist  -  Tutor@python.org
> To unsubscribe or change subscription options:
> https://mail.python.org/mailman/listinfo/tutor


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-08-01 Thread Saket Mehrotra
Hi

I am also not using any Open SSL package.
I have just added  " import requests" in py file. And when I run the module
I   get the SSL package error ,not sure why.

Thanks
Saket

On Tue, Jul 31, 2018 at 10:28 PM, Marc Tompkins 
wrote:

> This is a general Python tutor group; I'm not sure anybody here can help
> you with the OpenSSL package (I've definitely never used it myself.)  We're
> all willing to help, but this might not be the right place to ask this
> question.
>
> More to the point, though, when you ask questions on this list it's best
> to just cut and paste BOTH your code and the actual error
> message/traceback; from the bit that you've posted, it sounds like it might
> be as simple as a typo, but we can't really tell without seeing your code.
>
> On Mon, Jul 30, 2018 at 7:52 PM, Saket Mehrotra 
> wrote:
>
>> Hi
>>
>> I am trying to run import requests in a py file but I am getting below
>> error  ssl.PROTOCOL_SSLv23: OpenSSL.SSL.SSLv23_METHOD,
>> AttributeError: module 'ssl' has no attribute 'PROTOCOL_SSLv23'
>> >>>
>>
>> I tried to execute below from the terminal but it still remains
>> unresolved.
>>
>> sudo easy_install --upgrade pip
>>
>> I've also had to run:
>>
>> sudo pip uninstall pyopenssl
>>
>> sudo pip install mozdownload
>>
>>
>> Can you please help me .
>>
>> Thanks & Regards
>> Saket Mehrotra
>> ___
>> Tutor maillist  -  Tutor@python.org
>> To unsubscribe or change subscription options:
>> https://mail.python.org/mailman/listinfo/tutor
>>
>
>
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-08-01 Thread Alan Gauld via Tutor
On 01/08/18 05:07, Saket Mehrotra wrote:
> Hi
> 
> I am also not using any Open SSL package.
> I have just added  " import requests" in py file. And when I run the module
> I   get the SSL package error ,not sure why.

Then you really need to send the complete error message
and the code that generates it - the full function
definition at least.

-- 
Alan G
Author of the Learn to Program web site
http://www.alan-g.me.uk/
http://www.amazon.com/author/alan_gauld
Follow my photo-blog on Flickr at:
http://www.flickr.com/photos/alangauldphotos


___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-08-01 Thread Marc Tompkins
On Wed, Aug 1, 2018 at 1:13 AM, Alan Gauld via Tutor 
wrote:

> On 01/08/18 05:07, Saket Mehrotra wrote:
> > Hi
> >
> > I am also not using any Open SSL package.
> > I have just added  " import requests" in py file. And when I run the
> module
> > I   get the SSL package error ,not sure why.
>
> Then you really need to send the complete error message
> and the code that generates it - the full function
> definition at least.
>

THIS.
Give us the _whole_ error message, even the parts that look like they don't
make any sense.  For one thing, the traceback tells us exactly which line
of code triggered the exception - and which file that line of code came
from.  From your description, it sounds like the error is being thrown by
the requests module, but we can't tell.

I've just taken a look at the source for "requests"; it never asks for
 PROTOCOL_SSLv23
specifically, so I don't know where that's coming from.  PROTOCOL_SSLv23 is
a constant in the standard-library ssl module, but not in pyopenssl.  (You
mentioned that you uninstalled pyopenssl, but requests imports it - so
there must be another copy of it on your machine somewhere?)

I can't emphasize this enough: the right way to ask questions is also the
easiest way - cut and paste.  Don't paraphrase, don't edit, don't try to be
creative or descriptive.  Just give us the entire error message and
traceback, and we can go from there.
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor


Re: [Tutor] SSL Error

2018-08-03 Thread Terry Carroll

On Wed, 1 Aug 2018, Marc Tompkins wrote:


On 01/08/18 05:07, Saket Mehrotra wrote:

Hi

I am also not using any Open SSL package.
I have just added  " import requests" in py file. And when I run the

module

I   get the SSL package error ,not sure why.

Give us the _whole_ error message, even the parts that look like they don't
make any sense.  For one thing, the traceback tells us exactly which line
of code triggered the exception - and which file that line of code came
from.  From your description, it sounds like the error is being thrown by
the requests module, but we can't tell.


Also, before your "import requests" line, include these:

import sys
print(sys.version)

After the  "import requests" line, include this:

print(requests.__version__)


--
Terry Carroll
carr...@tjc.com
___
Tutor maillist  -  Tutor@python.org
To unsubscribe or change subscription options:
https://mail.python.org/mailman/listinfo/tutor