[prev in list] [next in list] [prev in thread] [next in thread] 

List:       pykde
Subject:    Re: pyqtdeploy: Error in sysconfig.get_path('purelib')
From:       Patrick Stinson <patrickkidd () gmail ! com>
Date:       2022-11-08 16:50:35
Message-ID: CADb17j1-t1zdQwP4a4TE7tSfQskkOz+FiFFqMQ-E_FpWC+gh1A () mail ! gmail ! com
[Download RAW message or body]

Glad to hear you reported it. I was out of touch with the list for a couple
of years there.

I can't catch it since it's bugsnag that is making the call. So I created
this somewhat dirty workaround:

import sysconfig

# Python-3.8+ patch sysconfig._init_non_posix() to support
_imp.extension_suffixes() == [] for pyqtdeploy
def _init_non_posix_pyqtdeploy(vars):
"""Initialize the module as appropriate for NT"""
# set basic install directories
import _imp
vars['LIBDEST'] = sysconfig.get_path('stdlib')
vars['BINLIBDEST'] = sysconfig.get_path('platstdlib')
vars['INCLUDEPY'] = sysconfig.get_path('include')
vars['EXT_SUFFIX'] = None # Here is the fix - don't call _imp.
extension_suffixes()
vars['EXE'] = '.exe'
vars['VERSION'] = sysconfig._PY_VERSION_SHORT_NO_DOT
vars['BINDIR'] = os.path.dirname(sysconfig._safe_realpath(sys.executable))
vars['TZPATH'] = ''
if sys.version_info[1] > 7:
sysconfig._init_non_posix = _init_non_posix_pyqtdeploy

On Mon, Nov 7, 2022 at 3:54 AM Phil Thompson <phil@riverbankcomputing.com>
wrote:

> On 03/11/2022 20:16, Patrick Stinson wrote:
> > Looks like that line is added to Lib/sysconfig.py in Python-3.8.
> >
> > _imp.extension_suffixes() returns [] for pyqtdeploy,
> > so sysconfig._init_non_posix() will always fail.
>
> It's a straightforward Python bug which I have reported. It only affects
> Windows with dynamic loading disabled. Can you work around it by
> catching and ignoring the exception?
>
> Phil
>

[Attachment #3 (text/html)]

<div dir="ltr">Glad to hear you reported it. I was out of touch with the list for a \
couple of years there.<div><br></div><div>I can&#39;t catch it since it&#39;s bugsnag \
that is making the call. So I created this somewhat dirty \
workaround:</div><div><br></div><div><div \
style="font-family:Menlo,Monaco,&quot;Courier \
New&quot;,monospace;font-size:12px;line-height:18px;white-space:pre"><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">    <span \
style="color:rgb(197,134,192)">import</span> <span \
style="color:rgb(78,201,176)">sysconfig</span></div><font color="#d4d4d4"><span \
style="background-color:rgb(30,30,30)"><br></span></font><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">    <span \
style="color:rgb(106,153,85)"># Python-3.8+ patch sysconfig._init_non_posix() to \
support _imp.extension_suffixes() == [] for pyqtdeploy</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">    <span \
style="color:rgb(86,156,214)">def</span> <span \
style="color:rgb(220,220,170)">_init_non_posix_pyqtdeploy</span>(<span \
style="color:rgb(156,220,254)">vars</span>):</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(206,145,120)">&quot;&quot;&quot;Initialize the module as appropriate \
for NT&quot;&quot;&quot;</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(106,153,85)"># set basic install directories</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(197,134,192)">import</span> <span \
style="color:rgb(78,201,176)">_imp</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;LIBDEST&#39;</span>] = <span \
style="color:rgb(78,201,176)">sysconfig</span>.<span \
style="color:rgb(220,220,170)">get_path</span>(<span \
style="color:rgb(206,145,120)">&#39;stdlib&#39;</span>)</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;BINLIBDEST&#39;</span>] = <span \
style="color:rgb(78,201,176)">sysconfig</span>.<span \
style="color:rgb(220,220,170)">get_path</span>(<span \
style="color:rgb(206,145,120)">&#39;platstdlib&#39;</span>)</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;INCLUDEPY&#39;</span>] = <span \
style="color:rgb(78,201,176)">sysconfig</span>.<span \
style="color:rgb(220,220,170)">get_path</span>(<span \
style="color:rgb(206,145,120)">&#39;include&#39;</span>)</div><div style=""><font \
color="#d4d4d4"><span style="background-color:rgb(30,30,30)">        \
</span></font><span style="color:rgb(156,220,254);background-color:rgb(30,30,30)">vars</span><font \
color="#d4d4d4"><span style="background-color:rgb(30,30,30)">[</span></font><span \
style="color:rgb(206,145,120);background-color:rgb(30,30,30)">&#39;EXT_SUFFIX&#39;</span><font \
color="#d4d4d4"><span style="background-color:rgb(30,30,30)">] = </span></font><span \
style="color:rgb(86,156,214);background-color:rgb(30,30,30)">None # Here is the fix - \
don&#39;t call </span><span \
style="color:rgb(70,224,192);background-color:rgb(30,30,30);font-family:Consolas,&quot;Courier \
New&quot;,monospace;font-size:14px;white-space:pre-wrap">_imp.</span><span \
style="color:rgb(99,99,36);background-color:rgb(30,30,30);font-family:Consolas,&quot;Courier \
New&quot;,monospace;font-size:14px;white-space:pre-wrap">extension_suffixes()</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;EXE&#39;</span>] = <span \
style="color:rgb(206,145,120)">&#39;.exe&#39;</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;VERSION&#39;</span>] = <span \
style="color:rgb(78,201,176)">sysconfig</span>._PY_VERSION_SHORT_NO_DOT</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;BINDIR&#39;</span>] = <span \
style="color:rgb(78,201,176)">os</span>.<span \
style="color:rgb(78,201,176)">path</span>.<span \
style="color:rgb(220,220,170)">dirname</span>(<span \
style="color:rgb(78,201,176)">sysconfig</span>._safe_realpath(<span \
style="color:rgb(78,201,176)">sys</span>.<span \
style="color:rgb(156,220,254)">executable</span>))</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(156,220,254)">vars</span>[<span \
style="color:rgb(206,145,120)">&#39;TZPATH&#39;</span>] = <span \
style="color:rgb(206,145,120)">&#39;&#39;</span></div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">    <span \
style="color:rgb(197,134,192)">if</span> <span \
style="color:rgb(78,201,176)">sys</span>.<span \
style="color:rgb(156,220,254)">version_info</span>[<span \
style="color:rgb(181,206,168)">1</span>] &gt; <span \
style="color:rgb(181,206,168)">7</span>:</div><div \
style="color:rgb(212,212,212);background-color:rgb(30,30,30)">        <span \
style="color:rgb(78,201,176)">sysconfig</span>._init_non_posix = <span \
style="color:rgb(220,220,170)">_init_non_posix_pyqtdeploy</span></div></div></div></div><br><div \
class="gmail_quote"><div dir="ltr" class="gmail_attr">On Mon, Nov 7, 2022 at 3:54 AM \
Phil Thompson &lt;<a \
href="mailto:phil@riverbankcomputing.com">phil@riverbankcomputing.com</a>&gt; \
wrote:<br></div><blockquote class="gmail_quote" style="margin:0px 0px 0px \
0.8ex;border-left:1px solid rgb(204,204,204);padding-left:1ex">On 03/11/2022 20:16, \
Patrick Stinson wrote:<br> &gt; Looks like that line is added to Lib/sysconfig.py in \
Python-3.8.<br> &gt; <br>
&gt; _imp.extension_suffixes() returns [] for pyqtdeploy,<br>
&gt; so sysconfig._init_non_posix() will always fail.<br>
<br>
It&#39;s a straightforward Python bug which I have reported. It only affects <br>
Windows with dynamic loading disabled. Can you work around it by <br>
catching and ignoring the exception?<br>
<br>
Phil<br>
</blockquote></div>



[prev in list] [next in list] [prev in thread] [next in thread] 

Configure | About | News | Add a list | Sponsored by KoreLogic