Re: how to specify trusted hosts in windows config file

2020-03-31 Thread dcwhatthe
On Monday, March 30, 2020 at 5:36:00 PM UTC-4, Chris Angelico wrote:
> On Tue, Mar 31, 2020 at 8:21 AM  wrote:
> >
> > On Monday, March 30, 2020 at 2:49:55 PM UTC-4, Chris Angelico wrote:
> > > On Tue, Mar 31, 2020 at 5:46 AM dc wrote:
> > > >
> > > > These are some of the command lines I've typed, and the results.  It 
> > > > looks like it's going to https://pypi.org.
> > > >
> > > > I have no idea whether that's correct, or not.
> > > >
> > > > I'm able to get past the Certificate error with other packages like 
> > > > requests.  But I just can't update pip.
> > > >
> > >
> > > That is the correct domain name. The question is, does it translate to
> > > the correct IP address? Try doing a DNS lookup and compare it to the
> > > results I got.
> > >
> > > And, don't think in terms of *getting past the error*. Try to solve
> > > the actual problem. The certificate error is protecting you against
> > > installing a forged version of PIP.
> > >
> > > ChrisA
> >
> > For pypi.org alone, my dns lookup differs from yours:  151.101.128.223.
> >
> > Chris,
> >
> > Is there a way to just install pip manually, and bypass all this?  I mean, 
> > if we know we're downloading it from the appropriate ftp or git site, then 
> > doesn't that in itself avoid a faulty PIP version?
> >
> 
> Ahh, I think I see what's happening. Something's interfering with your
> DNS - that's a Fastly IP address. I think the best solution would be
> to undo or bypass whatever's messing with your network, and then
> you'll be able to use pip normally without any sort of issues.
> 
> ChrisA

Which is what I thought I was trying to do.

Why does the latest Python come with an earlier version of pip, to begin with?

Maybe I can update pip on another Win10 PC, identify the changed folders, and 
copy them over.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to specify trusted hosts in windows config file

2020-03-31 Thread dcwhatthe
On Tuesday, March 31, 2020 at 5:48:50 AM UTC-4, dcwh...@gmail.com wrote:
> On Monday, March 30, 2020 at 5:36:00 PM UTC-4, Chris Angelico wrote:
> > On Tue, Mar 31, 2020 at 8:21 AM  wrote:
> > >
> > > On Monday, March 30, 2020 at 2:49:55 PM UTC-4, Chris Angelico wrote:
> > > > On Tue, Mar 31, 2020 at 5:46 AM dc wrote:
> > > > >
> > > > > These are some of the command lines I've typed, and the results.  It 
> > > > > looks like it's going to https://pypi.org.
> > > > >
> > > > > I have no idea whether that's correct, or not.
> > > > >
> > > > > I'm able to get past the Certificate error with other packages like 
> > > > > requests.  But I just can't update pip.
> > > > >
> > > >
> > > > That is the correct domain name. The question is, does it translate to
> > > > the correct IP address? Try doing a DNS lookup and compare it to the
> > > > results I got.
> > > >
> > > > And, don't think in terms of *getting past the error*. Try to solve
> > > > the actual problem. The certificate error is protecting you against
> > > > installing a forged version of PIP.
> > > >
> > > > ChrisA
> > >
> > > For pypi.org alone, my dns lookup differs from yours:  151.101.128.223.
> > >
> > > Chris,
> > >
> > > Is there a way to just install pip manually, and bypass all this?  I 
> > > mean, if we know we're downloading it from the appropriate ftp or git 
> > > site, then doesn't that in itself avoid a faulty PIP version?
> > >
> > 
> > Ahh, I think I see what's happening. Something's interfering with your
> > DNS - that's a Fastly IP address. I think the best solution would be
> > to undo or bypass whatever's messing with your network, and then
> > you'll be able to use pip normally without any sort of issues.
> > 
> > ChrisA
> 
> Which is what I thought I was trying to do.
> 
> Why does the latest Python come with an earlier version of pip, to begin with?
> 
> Maybe I can update pip on another Win10 PC, identify the changed folders, and 
> copy them over.

Finally got it.  Damn, this was a nightmare:


python get-pip.py --trusted-host pypi.org --trusted-host files.pythonhosted.org

Collecting pip
  Downloading pip-20.0.2-py2.py3-none-any.whl (1.4 MB)
 || 1.4 MB 64 kB/s
Collecting wheel
  Downloading wheel-0.34.2-py2.py3-none-any.whl (26 kB)
Installing collected packages: pip, wheel
  Attempting uninstall: pip
Found existing installation: pip 19.2.3
Uninstalling pip-19.2.3:
  Successfully uninstalled pip-19.2.3
Successfully installed pip-20.0.2 wheel-0.34.2

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


Re: how to specify trusted hosts in windows config file

2020-03-31 Thread Chris Angelico
On Tue, Mar 31, 2020 at 8:51 PM  wrote:
>
> On Monday, March 30, 2020 at 5:36:00 PM UTC-4, Chris Angelico wrote:
> > On Tue, Mar 31, 2020 at 8:21 AM  wrote:
> > >
> > > On Monday, March 30, 2020 at 2:49:55 PM UTC-4, Chris Angelico wrote:
> > > > On Tue, Mar 31, 2020 at 5:46 AM dc wrote:
> > > > >
> > > > > These are some of the command lines I've typed, and the results.  It 
> > > > > looks like it's going to https://pypi.org.
> > > > >
> > > > > I have no idea whether that's correct, or not.
> > > > >
> > > > > I'm able to get past the Certificate error with other packages like 
> > > > > requests.  But I just can't update pip.
> > > > >
> > > >
> > > > That is the correct domain name. The question is, does it translate to
> > > > the correct IP address? Try doing a DNS lookup and compare it to the
> > > > results I got.
> > > >
> > > > And, don't think in terms of *getting past the error*. Try to solve
> > > > the actual problem. The certificate error is protecting you against
> > > > installing a forged version of PIP.
> > > >
> > > > ChrisA
> > >
> > > For pypi.org alone, my dns lookup differs from yours:  151.101.128.223.
> > >
> > > Chris,
> > >
> > > Is there a way to just install pip manually, and bypass all this?  I 
> > > mean, if we know we're downloading it from the appropriate ftp or git 
> > > site, then doesn't that in itself avoid a faulty PIP version?
> > >
> >
> > Ahh, I think I see what's happening. Something's interfering with your
> > DNS - that's a Fastly IP address. I think the best solution would be
> > to undo or bypass whatever's messing with your network, and then
> > you'll be able to use pip normally without any sort of issues.
> >
> > ChrisA
>
> Which is what I thought I was trying to do.
>
> Why does the latest Python come with an earlier version of pip, to begin with?

Because the latest Python is older than the latest pip.

> Finally got it.  Damn, this was a nightmare:
>
> python get-pip.py --trusted-host pypi.org --trusted-host 
> files.pythonhosted.org

What you just did was say "hey, I know that I'm being lied to about
where pypi.org is, but I'm going to pretend that it's perfect". Do you
REALLY trust it so much that you would ignore the protections of SSL
certificates? You just installed something onto your computer without
knowing that it's what it claims to be. For all you know, that could
be a forged version of pip that has anything at all in it.

It would be FAR better to actually fix the problem - change your DNS
settings so you actually get the true server.

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


my matplotlib realtime plot doesn't show the line between the points

2020-03-31 Thread Nicolas Marat
hi guys, i need help because my matplotlib realtime plot doesn't show the line 
between the points.
even if i right '.k-' 
thit plot is display in a qwidget in an other code
wirdely that if i put bar it actualy working.
the real time data come from an arduino sensor 
that the shape of the data i have to plot:

ser_bytes = ser.readline()
value = float(ser_bytes[0:len(ser_bytes)-2].decode("utf-8"))




that is my code: 

class MplWidget(QWidget ):


def __init__( self, parent = None):

QWidget.__init__(self, parent)

self.canvas = FigureCanvas(Figure())

vertical_layout = QVBoxLayout() 
vertical_layout.addWidget(self.canvas)

self.canvas.axes = self.canvas.figure.add_subplot(1,1,1)
self.canvas.axes.set_ylim(0,90)
self.canvas.axes.set_xlim(0,100)
self.setLayout(vertical_layout)
   

def update_graph(self, value):

y = list()
x = list()


y.append(value)
x.append(self.i)
 
self.i += 1

   
self.MplWidget.canvas.axes.set_xlim(left=max(0, self.i-40), right= 
self.i+60)
self.MplWidget.canvas.axes.bar(x, y,)#'.k-')
self.MplWidget.canvas.axes.set_title('pull') 
self.MplWidget.canvas.draw()



thanks for help!

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


Re: my matplotlib realtime plot doesn't show the line between the points

2020-03-31 Thread Nicolas Marat
sorry that the real piece of code




self.MplWidget.canvas.axes.set_xlim(left=max(0, self.i-40), right= 
self.i+60)
self.MplWidget.canvas.axes.plot(x, y,'.k-')
self.MplWidget.canvas.axes.set_title('pull')
self.MplWidget.canvas.draw()
-- 
https://mail.python.org/mailman/listinfo/python-list


error in running python

2020-03-31 Thread Santosh Reddy
i installed python and when i open the app, i get this

the code execution cannot proceed because python38.dll was not found.
reinstalling the proram may fix this problem.

please help me in this one.
-- 
https://mail.python.org/mailman/listinfo/python-list


about to resolve problem in installation

2020-03-31 Thread Kapuganti Rakesh
Respected sir,
 I have downloaded the latest version of python 3.8.2
in my windows 10. I have installed that.After completion of installation
process it is displaying three options of modify,repair and uninstall. How
to resolve that issue. please help me
   Thanking You
-- 
https://mail.python.org/mailman/listinfo/python-list


Not Running from Kindle

2020-03-31 Thread if only
I’m following the Kindle download and get to writing hello world but that does 
not get to my command window?


J Carrod

Sent from Mail for Windows 10

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


Re: [baseline 1.0.0] Easy String Baseline

2020-03-31 Thread Dasy Dong
>
> I am please to  share you with a interview summary[Chinese Language] about
> python.
> Mainly covering backend architecture  including python principle, design
> patterns , data structure, Git, Redis, MySql, Spider, ELK,Kafka, Istio,
> Kubernetes...
> I will keep updating contents future , If you love the  Chinese version,
> welcome  to join contribution
>
> Repo: https://github.com/DasyDong/interview_python_practice/
>
> With Regards
> Dasy
> --
> Python-announce-list mailing list -- python-announce-l...@python.org
> To unsubscribe send an email to python-announce-list-le...@python.org
> https://mail.python.org/mailman3/lists/python-announce-list.python.org/
>
> Support the Python Software Foundation:
> http://www.python.org/psf/donations/
>
-- 
https://mail.python.org/mailman/listinfo/python-list


error in importing

2020-03-31 Thread Jami Yaswanth
i am not able to use the libraries that are installed
using "pip install pandas"
-- 
https://mail.python.org/mailman/listinfo/python-list


EuroPython 2020: Online conference from July 23-26

2020-03-31 Thread M.-A. Lemburg
In the last two weeks, we have discussed and investigated concepts
around running this year’s EuroPython conference as an online
conference. We have looked at conference tools, your feedback, drafted
up ideas on what we can do to make the event interesting and what we
can accomplish given our limited resources.

Today, we are happy to announce that we will be running


 * EuroPython 2020 *

from July 23 - 26 2020
   as an online conference


We are planning the following structure:

- 2 conference days with keynotes, talks, lightning talks, poster
  session (Thursday and Friday)

- 2 sprint days with multiple sprint teams (Saturday and Sunday)

Attending the conference days will require a ticket, participating in
the sprint days will be free.


We will publish additional information on the new format as it becomes
available. A few updates for today (more details will follow in
separate blog posts):

Call for Papers (CFP)
-

With the new plan in place, we will extend and retarget the CFP we had
been running in the last three weeks to the online setup.

Please note that we will not have training sessions at EuroPython
2020. We will have keynotes, 30 and 45-minute talks, panels,
interactive sessions, as well as try to come up with a format for
doing posters and lightning talks.

Unlike for our in-person event, speakers will get free tickets to the
event, since we don’t have to cover catering costs.

We need your help
-

Given that we had already put a lot of work into the in-person event
organization, a lot of which we’ll now have to adapt or redo for the
online set up in the few months ahead of us, we will need more help
from the community to make this happen.

If you would like to help, please write to bo...@europython.eu. We are
specifically looking for people with experience using online
conference tools to help host tracks during the conference days.

Sponsoring
--

As for the in-person event, we will have sponsorship packages
available for the online event as well. Because the format is
different, we’ll have to adjust the packages we had intended for the
in-person to an online setup.

If you are interested in sponsoring EuroPython 2020, please write to
sponsor...@europython.eu. We will then send you more details, as they
become available.


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/614102095419850752/europython-2020-online-conference-from-july-23-26

Tweet:

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

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

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


Re: error in running python

2020-03-31 Thread Souvik Dutta
Do you have direct X installed in your machine?

On Tue, Mar 31, 2020, 5:44 PM Santosh Reddy  wrote:

> i installed python and when i open the app, i get this
>
> the code execution cannot proceed because python38.dll was not found.
> reinstalling the proram may fix this problem.
>
> please help me in this one.
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Not Running from Kindle

2020-03-31 Thread Calvin Spealman
There is no official Python app download for Kindle fire. If that's what
you've found and are trying to use, you'll need to contact the developer
responsible. If you want the official distribution of Python, you can
download it from python.org on a Windows, Mac, or Linux PC.

On Tue, Mar 31, 2020 at 8:26 AM if only  wrote:

> I’m following the Kindle download and get to writing hello world but that
> does not get to my command window?
>
>
> J Carrod
>
> Sent from Mail for
> Windows 10
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

cspea...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: about to resolve problem in installation

2020-03-31 Thread Calvin Spealman
You are trying to run the installer after you've already installed Python.

Instead, you want to open your start menu and search for Python or IDLE
(the Python editor) to actually run and use the Python version you've
already installed.

On Tue, Mar 31, 2020 at 8:22 AM Kapuganti Rakesh <
kapugantirakesh...@gmail.com> wrote:

> Respected sir,
>  I have downloaded the latest version of python 3.8.2
> in my windows 10. I have installed that.After completion of installation
> process it is displaying three options of modify,repair and uninstall. How
> to resolve that issue. please help me
>Thanking You
> --
> https://mail.python.org/mailman/listinfo/python-list
>
>

-- 

CALVIN SPEALMAN

SENIOR QUALITY ENGINEER

cspea...@redhat.com  M: +1.336.210.5107
[image: https://red.ht/sig] 
TRIED. TESTED. TRUSTED. 
-- 
https://mail.python.org/mailman/listinfo/python-list


dynamic import of dynamically created modules failes

2020-03-31 Thread Stephan Lukits

Hello,

background:

- a daemon creates package p1 (e.g. directory with __init__.py-file) and 
in p1 a module m1 is created.


- Then the daemon wants to import from m1, which functions (so far all 
the time).


- Then a module m2 is created in p1 and the daemon wants to import from 
m2 which fails (most of the time but *not* always) with ModuleNotFoundError.


See the little test script at the end which reproduces the problem.

The very strange thing for me is, that the import of m2 in the test 
script sometimes works.  I wonder if there is some 
package-content-caching.  And if so how to prevent or re-trigger it.


(neither a reload of p1 nor a deletion of p1 from sys.modules does the 
trick)



-test-script---

"""

(python --version: Python 3.8.2)

Dynamic import of dynamically created modules right after creation.
"""

from shutil import rmtree
from os import path, chdir, mkdir, listdir
from importlib import import_module, reload
import sys

# for test-package creation
P1 = 'p1'
INIT = '__init__.py'
INIT_CONTENT = """\
# -*- coding: utf-8 -*-
"""

# for first test-module creation
M1 = 'm1'
M1_CONTENT = """\
# -*- coding: utf-8 -*-

answer = 42
"""

# for second test-module creation
M2 = 'm2'
M2_CONTENT = """\
# -*- coding: utf-8 -*-

hello = 'world'
"""

chdir(path.dirname(__file__))    # make sure we are in the right directory

if path.isdir(P1):
    rmtree(P1)   # always start off under the same 
conditions



mkdir(P1)    # create test-package and first test-module
with open(path.join(P1, INIT), 'w') as f:
    f.write(INIT_CONTENT)
with open(path.join(P1, M1+'.py'), 'w') as f:
    f.write(M1_CONTENT)

# import from the just created module; this worked always so far
from p1.m1 import answer

print(f'{answer=}')

with open(path.join(P1, M2+'.py'), 'w') as f:
    f.write(M2_CONTENT)  # create the second test-module

# check current directory, file and module structure
print('wd-content:', ', '.join(listdir()))
print('p1-content:', ', '.join(listdir(P1)))
print('p1-modlues:', ', '.join([m for m in sys.modules if 
m.startswith('p1')]))

# reload(sys.modules['p1'])  # neither a reload
# del sys.modules['p1']  # nor a deletion of p1 does the trick

# here it most of the time fails (but NOT all the time)
# so far if it fails it fails in all three variants
# so far if it works the 'from ...'-import works already
try:
    from p1.m2 import hello
except ModuleNotFoundError:
    try:
    hello = getattr(import_module('p1.m2'), 'hello')
    except ModuleNotFoundError:
    try:
    hello = getattr(__import__('p1.m2', fromlist=[None]), 'hello')
    except ModuleNotFoundError:
    raise
    else:
    print("__import__-import worked")
    else:
    print("import_module-import worked")
else:
    print("'from ... '-import worked")

print(f'{hello=}')

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


Re: how to specify trusted hosts in windows config file

2020-03-31 Thread dcwhatthe
I don't have control over this, Chris.  This is at my office.  I'm not the 
resource who manages network or other settings.  And we have various 
anti-spyware in place, that at leasts mitigates the risk.

What I'm doing isn't unprecedented.  People get false positives all the time on 
the web, and ask for this type of assistance.  Maybe my results were real 
evidence of something funky, but either way I have to get work done.

Thanks for trying to help, anyway.  I'll do a compare of the refreshed PIP 
files on the office PC, to a copy of pip elsewhere that I know is legit.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: about to resolve problem in installation

2020-03-31 Thread Terry Reedy

On 3/31/2020 2:23 AM, Kapuganti Rakesh wrote:

Respected sir,
  I have downloaded the latest version of python 3.8.2
in my windows 10. I have installed that.After completion of installation
process it is displaying three options of modify,repair and uninstall. How
to resolve that issue. please help me


You are re-running the installer.  Hit 'start' in lower left corner and 
find python under 'p'.


--
Terry Jan Reedy

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


Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Dieter Maurer
Stephan Lukits wrote at 2020-3-31 17:44 +0300:
>background:
>
>- a daemon creates package p1 (e.g. directory with __init__.py-file) and
>in p1 a module m1 is created.
>
>- Then the daemon wants to import from m1, which functions (so far all
>the time).
>
>- Then a module m2 is created in p1 and the daemon wants to import from
>m2 which fails (most of the time but *not* always) with ModuleNotFoundError.
>
>See the little test script at the end which reproduces the problem.
> ...

I remember a similar report (some time ago). There, caching has
been responsible. I have forgotten how to invalidate the caches.
But, you could try logic found in
`importlib._bootstrap_external.PathFinder.invalidate_caches`.
-- 
https://mail.python.org/mailman/listinfo/python-list


Fwd: about to resolve problem in installation

2020-03-31 Thread Kapuganti Rakesh
-- Forwarded message -
From: Kapuganti Rakesh 
Date: Tue, 31 Mar 2020 at 19:02
Subject: Re: about to resolve problem in installation
To: Calvin Spealman 


I have already search in my pc but it is showing nothing and later i
searched python and started that app.After some it showing
I am getting confuse over this. pls help me

On Tue, 31 Mar 2020 at 18:46, Calvin Spealman  wrote:

> You are trying to run the installer after you've already installed Python.
>
> Instead, you want to open your start menu and search for Python or IDLE
> (the Python editor) to actually run and use the Python version you've
> already installed.
>
> On Tue, Mar 31, 2020 at 8:22 AM Kapuganti Rakesh <
> kapugantirakesh...@gmail.com> wrote:
>
>> Respected sir,
>>  I have downloaded the latest version of python 3.8.2
>> in my windows 10. I have installed that.After completion of installation
>> process it is displaying three options of modify,repair and uninstall. How
>> to resolve that issue. please help me
>>Thanking You
>> --
>> https://mail.python.org/mailman/listinfo/python-list
>>
>>
>
> --
>
> CALVIN SPEALMAN
>
> SENIOR QUALITY ENGINEER
>
> cspea...@redhat.com  M: +1.336.210.5107
> [image: https://red.ht/sig] 
> TRIED. TESTED. TRUSTED. 
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
"Dieter Maurer"  writes:

> Stephan Lukits wrote at 2020-3-31 17:44 +0300:
>>background:
>>
>>- a daemon creates package p1 (e.g. directory with __init__.py-file) and
>>in p1 a module m1 is created.
>>
>>- Then the daemon wants to import from m1, which functions (so far all
>>the time).
>>
>>- Then a module m2 is created in p1 and the daemon wants to import from
>>m2 which fails (most of the time but *not* always) with ModuleNotFoundError.
>>
>>See the little test script at the end which reproduces the problem.
>> ...
>
> I remember a similar report (some time ago). There, caching has
> been responsible. I have forgotten how to invalidate the caches.
> But, you could try logic found in
> `importlib._bootstrap_external.PathFinder.invalidate_caches`.

The first import creates a file __pycache__ in the directory p1.
To remove it use rmtree(path.join(P1,'__pycache__'))
Then the second import will succeed.
-- 
Pieter van Oostrum
www: http://pieter.vanoostrum.org/
PGP key: [8DAE142BE17999C4]
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: how to specify trusted hosts in windows config file

2020-03-31 Thread Chris Angelico
On Wed, Apr 1, 2020 at 3:31 AM  wrote:
>
> I don't have control over this, Chris.  This is at my office.  I'm not the 
> resource who manages network or other settings.  And we have various 
> anti-spyware in place, that at leasts mitigates the risk.
>

Then talk to the person who does. Ask if s/he is okay with you
downloading untrusted code from the internet and running it with your
full permissions. Then ask if it would be better to be able to trust
that code's origin.

> What I'm doing isn't unprecedented.  People get false positives all the time 
> on the web, and ask for this type of assistance.  Maybe my results were real 
> evidence of something funky, but either way I have to get work done.
>

Yes, you have to get work done, so you ran random code from the
internet, downloaded on an unsecured connection, when the evidence
clearly showed that you were NOT getting it from the official source.

> Thanks for trying to help, anyway.  I'll do a compare of the refreshed PIP 
> files on the office PC, to a copy of pip elsewhere that I know is legit.
>

Good luck. Chances are you won't know you've been hit with any spyware
or anything, so you'll feel confident.

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


Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Pieter van Oostrum
Pieter van Oostrum  writes:

>
> The first import creates a file __pycache__ in the directory p1.
That should be 'a directory __pycache__'
> To remove it use rmtree(path.join(P1,'__pycache__'))
> Then the second import will succeed.
> -- 
> Pieter van Oostrum
> www: http://pieter.vanoostrum.org/
> PGP key: [8DAE142BE17999C4]

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


Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Stephan Lukits


On 3/31/20 9:01 PM, Pieter van Oostrum wrote:

"Dieter Maurer"  writes:


Stephan Lukits wrote at 2020-3-31 17:44 +0300:

background:

- a daemon creates package p1 (e.g. directory with __init__.py-file) and
in p1 a module m1 is created.

- Then the daemon wants to import from m1, which functions (so far all
the time).

- Then a module m2 is created in p1 and the daemon wants to import from
m2 which fails (most of the time but *not* always) with ModuleNotFoundError.

See the little test script at the end which reproduces the problem.
...

I remember a similar report (some time ago). There, caching has
been responsible. I have forgotten how to invalidate the caches.
But, you could try logic found in
`importlib._bootstrap_external.PathFinder.invalidate_caches`.

The first import creates a file __pycache__ in the directory p1.
To remove it use rmtree(path.join(P1,'__pycache__'))
Then the second import will succeed.



Thank you, but the behavior doesn't change.  I added


rmtree(path.join(P1, '__pycache__'))


Before the import:


try:
    from p1.m2 import hello


and still get (please note that there isn't a __pycache__ directory 
anymore):


answer=42
wd-content: __init__.py, p1
p1-content: __init__.py, __pycache__, m1.py, m2.py
p1-modlues: p1, p1.m1
p1-content after rmtree: __init__.py, m1.py, m2.py
Traceback (most recent call last):
  File "dynamic_modules/__init__.py", line 68, in 
    from p1.m2 import hello
ModuleNotFoundError: No module named 'p1.m2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dynamic_modules/__init__.py", line 71, in 
    hello = getattr(import_module('p1.m2'), 'hello')
  File 
"/home/goedel/.pyenv/versions/3.8.2/lib/python3.8/importlib/__init__.py", 
line 127, in import_module

    return _bootstrap._gcd_import(name[level:], package, level)
  File "", line 1014, in _gcd_import
  File "", line 991, in _find_and_load
  File "", line 973, in 
_find_and_load_unlocked

ModuleNotFoundError: No module named 'p1.m2'

During handling of the above exception, another exception occurred:

Traceback (most recent call last):
  File "dynamic_modules/__init__.py", line 74, in 
    hello = getattr(__import__('p1.m2', fromlist=[None]), 'hello')
ModuleNotFoundError: No module named 'p1.m2'

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


[Solved] Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Stephan Lukits



On 3/31/20 8:00 PM, Dieter Maurer wrote:

Stephan Lukits wrote at 2020-3-31 17:44 +0300:

background:

- a daemon creates package p1 (e.g. directory with __init__.py-file) and
in p1 a module m1 is created.

- Then the daemon wants to import from m1, which functions (so far all
the time).

- Then a module m2 is created in p1 and the daemon wants to import from
m2 which fails (most of the time but *not* always) with ModuleNotFoundError.

See the little test script at the end which reproduces the problem.
...

I remember a similar report (some time ago). There, caching has
been responsible. I have forgotten how to invalidate the caches.
But, you could try logic found in
`importlib._bootstrap_external.PathFinder.invalidate_caches`.


Yes, removing the entry for p1 from 'sys.path_importer_cache' seems to 
solve the problem.


Thank you.



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


Re: dynamic import of dynamically created modules failes

2020-03-31 Thread Peter Otten
Dieter Maurer wrote:

> Stephan Lukits wrote at 2020-3-31 17:44 +0300:
>>background:
>>
>>- a daemon creates package p1 (e.g. directory with __init__.py-file) and
>>in p1 a module m1 is created.
>>
>>- Then the daemon wants to import from m1, which functions (so far all
>>the time).
>>
>>- Then a module m2 is created in p1 and the daemon wants to import from
>>m2 which fails (most of the time but *not* always) with
>>ModuleNotFoundError.
>>
>>See the little test script at the end which reproduces the problem.
>> ...
> 
> I remember a similar report (some time ago). There, caching has
> been responsible. I have forgotten how to invalidate the caches.
> But, you could try logic found in
> `importlib._bootstrap_external.PathFinder.invalidate_caches`.

[brainstorm mode]

Do namespace packages cache as aggressively? Maybe it would help to omit 
p1/__init__.py.

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


Re: error in importing

2020-03-31 Thread DL Neil via Python-list

On 31/03/20 11:23 PM, Jami Yaswanth wrote:

i am not able to use the libraries that are installed
using "pip install pandas"


Welcome to Python!

Are you aware of the Python-Tutor Discussion List?
(https://mail.python.org/mailman/listinfo/tutor)

Please describe how you installed these libraries.

Please describe how you start Python.

Please copy-paste all relevant code, plus the error messages received.
--
Regards =dn
--
https://mail.python.org/mailman/listinfo/python-list


Re: about to resolve problem in installation

2020-03-31 Thread boB Stepp
On Tue, Mar 31, 2020 at 12:02 PM Kapuganti Rakesh
 wrote:

> I have already search in my pc but it is showing nothing and later i
> searched python and started that app.After some it showing
> I am getting confuse over this. pls help me

If you press your Windows key (or click on the Windows symbol on the
task bar) you will have an alphabetically arranged list of programs.
Scroll down till you reach Python 3.8.  Expand that entry by clicking
on it.  If you did a normal installation you should see "IDLE...",
"Python 3.8..." and "Python 3.8 Module Docs..."  For your purposes you
probably would want to start with IDLE.  It will take you to Python's
interactive interpreter.  You will see a prompt that looks like ">>>"
You may type in Python statements after the prompt such as ">>> 3*2"
You can do more in IDLE (Much more), but you will need to have a
beginner's Python book or tutorial to guide you in what to do next.

By the way, there is a Python Tutor list that exists to help newcomers
to Python and/or programming.  Its subscription page may be found at:

https://mail.python.org/mailman/listinfo/tutor

Hope this helps you through your first steps!

Cheers!
boB
-- 
https://mail.python.org/mailman/listinfo/python-list