Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #89701 > unrolled thread

Looks like Python 3 files do not confirm to Python 3

Started byCecil Westerhof <Cecil@decebal.nl>
First post2015-05-01 08:27 +0200
Last post2015-05-01 11:18 +0200
Articles 6 — 3 participants

Back to article view | Back to comp.lang.python


Contents

  Looks like Python 3 files do not confirm to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 08:27 +0200
    Re: Looks like Python 3 files do not confirm to Python 3 Steven D'Aprano <steve+comp.lang.python@pearwood.info> - 2015-05-01 17:00 +1000
      Re: Looks like Python 3 files do not confirm to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 09:36 +0200
    Re: Looks like Python 3 files do not confirm to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 09:16 +0200
      Re: Looks like Python 3 files do not confirm to Python 3 Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-05-01 09:05 +0100
        Re: Looks like Python 3 files do not confirm to Python 3 Cecil Westerhof <Cecil@decebal.nl> - 2015-05-01 11:18 +0200

#89701 — Looks like Python 3 files do not confirm to Python 3

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-01 08:27 +0200
SubjectLooks like Python 3 files do not confirm to Python 3
Message-ID<87mw1orex3.fsf@Equus.decebal.nl>
On my system in:
/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py

it says:
    try:
        from ndg.httpsclient.subj_alt_name import SubjectAltName
        from pyasn1.codec.der import decoder as der_decoder
        SUBJ_ALT_NAME_SUPPORT = True
    except ImportError, e:
        SUBJ_ALT_NAME_SUPPORT = False
        SUBJ_ALT_NAME_SUPPORT_MSG = (
            'SubjectAltName support is disabled - check pyasn1 package '
            'installation to enable'
        )
        import warnings
        warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)

which gives:
    File "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py", line 17
      except ImportError, e:

Does my system have outdated files, or are there still Python 3 files
that do not conform to Python 3?

The only real python program I use at the moment uses:
    import urllib3.contrib.pyopenssl

and then you get this error.


So another reason to stay with Python 2. (While still writing code
that works in Python3.)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [next] | [standalone]


#89702

FromSteven D'Aprano <steve+comp.lang.python@pearwood.info>
Date2015-05-01 17:00 +1000
Message-ID<55432496$0$12994$c3e8da3$5496439d@news.astraweb.com>
In reply to#89701
On Fri, 1 May 2015 04:27 pm, Cecil Westerhof wrote:

> On my system in:
> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py

ndg is a third-party package, not part of the Python 3 standard library.

> it says:
>     try:
>         from ndg.httpsclient.subj_alt_name import SubjectAltName
>         from pyasn1.codec.der import decoder as der_decoder
>         SUBJ_ALT_NAME_SUPPORT = True
>     except ImportError, e:
[...]
> which gives:
>     File
>     "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py",
>     line 17
>       except ImportError, e:

I think you're missing the last line of the error. I'm guessing it was
probably NameError: name 'e' is not defined.


> Does my system have outdated files, or are there still Python 3 files
> that do not conform to Python 3?

I would say, either you have accidentally installed a Python 2 file in your
Python 3 library, or it is simply a bug in ndg.


-- 
Steven

[toc] | [prev] | [next] | [standalone]


#89708

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-01 09:36 +0200
Message-ID<87a8xorbq3.fsf@Equus.decebal.nl>
In reply to#89702
Op Friday 1 May 2015 09:00 CEST schreef Steven D'Aprano:

> On Fri, 1 May 2015 04:27 pm, Cecil Westerhof wrote:
>
>> On my system in:
>> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py
>
> ndg is a third-party package, not part of the Python 3 standard
> library.

Oops, barking up to the wrong tree. Sorry.


>> it says:
>> try:
>> from ndg.httpsclient.subj_alt_name import SubjectAltName
>> from pyasn1.codec.der import decoder as der_decoder
>> SUBJ_ALT_NAME_SUPPORT = True
>> except ImportError, e:
> [...]
>> which gives: File
>> "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py",
>> line 17 except ImportError, e:
>
> I think you're missing the last line of the error. I'm guessing it
> was probably NameError: name 'e' is not defined.

Nope:
        except ImportError, e:
                          ^
    SyntaxError: invalid syntax

It is solved by:
    except (ImportError) as e:

But then:
        PARSER_RE_STR = '/(%s)=' % '|'.join(DN_LUT.keys() + DN_LUT.values())
    TypeError: unsupported operand type(s) for +: 'dict_keys' and 'dict_values'


>> Does my system have outdated files, or are there still Python 3
>> files that do not conform to Python 3?
>
> I would say, either you have accidentally installed a Python 2 file
> in your Python 3 library, or it is simply a bug in ndg.

I will contact the ndg people.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89706

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-01 09:16 +0200
Message-ID<87ioccrcmp.fsf@Equus.decebal.nl>
In reply to#89701
Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof:

> On my system in:
> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py
>
> it says:
> try:
> from ndg.httpsclient.subj_alt_name import SubjectAltName
> from pyasn1.codec.der import decoder as der_decoder
> SUBJ_ALT_NAME_SUPPORT = True
> except ImportError, e:
> SUBJ_ALT_NAME_SUPPORT = False
> SUBJ_ALT_NAME_SUPPORT_MSG = (
> 'SubjectAltName support is disabled - check pyasn1 package '
> 'installation to enable'
> )
> import warnings
> warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)
>
> which gives: File
> "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py",
> line 17 except ImportError, e:

It is solved by making it:
    except (ImportError) as e:

The same for:
    /usr/lib/python3.4/site-packages/ndg/httpsclient/subj_alt_name.py

I would not mind to solve those and others if I could contribute them
to the Python community. What is the procedure for that?

>
> Does my system have outdated files, or are there still Python 3
> files that do not conform to Python 3?
>
> The only real python program I use at the moment uses:
> import urllib3.contrib.pyopenssl
>
> and then you get this error.
>
>
> So another reason to stay with Python 2. (While still writing code
> that works in Python3.)

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [next] | [standalone]


#89710

FromMark Lawrence <breamoreboy@yahoo.co.uk>
Date2015-05-01 09:05 +0100
Message-ID<mailman.2.1430467545.3347.python-list@python.org>
In reply to#89706
On 01/05/2015 08:16, Cecil Westerhof wrote:
> Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof:
>
>> On my system in:
>> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py
>>
>> it says:
>> try:
>> from ndg.httpsclient.subj_alt_name import SubjectAltName
>> from pyasn1.codec.der import decoder as der_decoder
>> SUBJ_ALT_NAME_SUPPORT = True
>> except ImportError, e:
>> SUBJ_ALT_NAME_SUPPORT = False
>> SUBJ_ALT_NAME_SUPPORT_MSG = (
>> 'SubjectAltName support is disabled - check pyasn1 package'
>> 'installation to enable'
>> )
>> import warnings
>> warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)
>>
>> which gives: File
>> "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py",
>> line 17 except ImportError, e:
>
> It is solved by making it:
>      except (ImportError) as e:
>
> The same for:
>      /usr/lib/python3.4/site-packages/ndg/httpsclient/subj_alt_name.py
>
> I would not mind to solve those and others if I could contribute them
> to the Python community. What is the procedure for that?
>

You'll have to find out who supports ndg as it's not standard Python. 
The big clue is the site-packages folder name, that's used for third 
party packages.  From searching I think it's this 
https://github.com/cedadev/ndg_httpsclient/ but please don't quote me on 
that.

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

Mark Lawrence

[toc] | [prev] | [next] | [standalone]


#89716

FromCecil Westerhof <Cecil@decebal.nl>
Date2015-05-01 11:18 +0200
Message-ID<87sibgpsep.fsf@Equus.decebal.nl>
In reply to#89710
Op Friday 1 May 2015 10:05 CEST schreef Mark Lawrence:

> On 01/05/2015 08:16, Cecil Westerhof wrote:
>> Op Friday 1 May 2015 08:27 CEST schreef Cecil Westerhof:
>>
>>> On my system in:
>>> /usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py
>>>
>>> it says:
>>> try:
>>> from ndg.httpsclient.subj_alt_name import SubjectAltName
>>> from pyasn1.codec.der import decoder as der_decoder
>>> SUBJ_ALT_NAME_SUPPORT = True
>>> except ImportError, e:
>>> SUBJ_ALT_NAME_SUPPORT = False
>>> SUBJ_ALT_NAME_SUPPORT_MSG = (
>>> 'SubjectAltName support is disabled - check pyasn1 package'
>>> 'installation to enable'
>>> )
>>> import warnings
>>> warnings.warn(SUBJ_ALT_NAME_SUPPORT_MSG)
>>>
>>> which gives: File
>>> "/usr/lib/python3.4/site-packages/ndg/httpsclient/ssl_peer_verification.py",
>>> line 17 except ImportError, e:
>>
>> It is solved by making it:
>> except (ImportError) as e:
>>
>> The same for:
>> /usr/lib/python3.4/site-packages/ndg/httpsclient/subj_alt_name.py
>>
>> I would not mind to solve those and others if I could contribute
>> them to the Python community. What is the procedure for that?
>>
>
> You'll have to find out who supports ndg as it's not standard
> Python. The big clue is the site-packages folder name, that's used
> for third party packages. From searching I think it's this
> https://github.com/cedadev/ndg_httpsclient/ but please don't quote
> me on that.

Yeah, I was barking up to the wrong tree.

I found an email address in the sources. The copyright is from 2012,
so hopefully it is still supported.

-- 
Cecil Westerhof
Senior Software Engineer
LinkedIn: http://www.linkedin.com/in/cecilwesterhof

[toc] | [prev] | [standalone]


Back to top | Article view | comp.lang.python


csiph-web