Re: stackless python 2.7.9 and openssl-1.1.1g

2020-09-29 Thread bhashkar prakash Singh
>Get the source of python.org python 2.7.18 and you will find that builds
without patches >against OpenSSL 1.1.1g.
>I would then diff the C files that do not compile in stackless to look for
the required fixes.

Thanks Barry. Some warnings were left in code after patching cpython files.
After fixing them, all those errors are gone.

Now I have another issue. now the threading module in python is not found.
I don't see this is anyway related to openssl upgrade but this issue is not
occurred where openssl has not been upgraded.

 File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in

from ._abnf import *
  File "/usr/lib/python2.7/site-packages/websocket/_abnf.py", line 30, in

from threading import Lock
  File "threading.py", line 6, in 
import thread
ImportError: No module named thread

Could you give any clue on this ?

Thanks & Regards,
Bhashkar

On Fri, Sep 25, 2020 at 12:43 PM Barry  wrote:

>
>
> On 25 Sep 2020, at 03:28, bhashkar prakash Singh 
> wrote:
>
> 
> Hi Barry,
>
> Thanks for your response.
>
> I am not an expert in python code. Could you please elaborate a bit more
> on this.  Which cpython code are you referring to?
> did you modify other files also apart from   _hashopenssl.c and _ssl.c to
> work with openssl-1.1.1g ?
>
>
> Get the source of python.org python 2.7.18 and you will find that builds
> without patches against OpenSSL 1.1.1g.
>
> I would then diff the C files that do not compile in stackless to look for
> the required fixes.
>
> Barry
>
>
> Regards,
> Bhashkar
>
> On Fri, Sep 25, 2020 at 2:40 AM Barry Scott 
> wrote:
>
>>
>>
>> > On 24 Sep 2020, at 19:21, bhashkar prakash Singh <
>> [email protected]> wrote:
>> >
>> > Hi,
>> >
>> > I am using stackless Python 2.7.9 in my project and openssl-1.0.2q.
>> > I just upgraded the Openssl  version to 1.1.1g, due to which python
>> > compilation started failing. So, I patched  _hashopenssl.c and _ssl.c
>> file
>> > in Python Modules as per new openssl  to make compilation successful.
>> > But when I run my image on  target HW,  I am getting below errors.  It
>> > looks like Openssl 1.1.1g libraries are not linked to Python.
>> > I am struggling with this issue since many days. Looks like something I
>> > missed in my patching. Could someone please help on this.
>>
>> I recently built python 2.7.18 against openssl 1.1.1g without issue.
>> Maybe look see what is in the cpython code that works fine.
>>
>> Barry
>> > Thanks & Regards,
>> > Bhashkar
>> > --
>> > https://mail.python.org/mailman/listinfo/python-list
>> >
>>
>>
-- 
https://mail.python.org/mailman/listinfo/python-list


Logging lib doesn't work

2020-09-29 Thread Alexandre FOURNEL
Hi all !

I'm trying to use logging lib in my python program. 

To try this lib, I am using basic code like : 

"import logging
logging.basicConfig(filename='pont.txt', filemode='w',format='%(asctime)s 
%(message)s', datefmt='%d/%m/%Y %H:%M:%S', level=logging.DEBUG)
logging.debug('This message should go to the log file')
logging.info('So should this')
logging.warning('And this, too')"

But between 2 execution, I have to open a new terminal to get new data in my 
file pont.txt. Do you know why ? 

Thanks 

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


Re: stackless python 2.7.9 and openssl-1.1.1g

2020-09-29 Thread Barry Scott


> On 29 Sep 2020, at 13:13, bhashkar prakash Singh  
> wrote:
> 
> >Get the source of python.org  python 2.7.18 and you will 
> >find that builds without patches >against OpenSSL 1.1.1g.
> >I would then diff the C files that do not compile in stackless to look for 
> >the required fixes.
> 
> Thanks Barry. Some warnings were left in code after patching cpython files. 
> After fixing them, all those errors are gone.
> 
> Now I have another issue. now the threading module in python is not found. 
> I don't see this is anyway related to openssl upgrade but this issue is not 
> occurred where openssl has not been upgraded.

When working on a project like this I tend to write a shell script that 
automates the build so that I repeat the build in the future.

Example (untested)

rm -rf tmp.build
mkdir tmp.build
cd tmp.build
tar xf ../Python-xxx.tar.gz
./configure --with-openssl=...
make

Then I can prove to myself that just changing the openssl changes the build.
And I run that script and create a log of the build output

$ ./do-build 2>&1 | tee build.log

Then I can go back and check what happened.

> 
>  File "/usr/lib/python2.7/site-packages/websocket/__init__.py", line 22, in 
> 
> from ._abnf import *
>   File "/usr/lib/python2.7/site-packages/websocket/_abnf.py", line 30, in 
> 
> from threading import Lock
>   File "threading.py", line 6, in 
> import thread
> ImportError: No module named thread
>  
> Could you give any clue on this ?

The cool thing about open source is that you have the source.

When hitting a problem like this I tend to search the sources for where, in
this case, thread might be.

That lead me the Python/thread.c in cpython. Is that the same in stackless?
Does the build compile that file? It seems that if you are missing
pthreads then its not going to work.

When you ran configure did it find pthread.h?
Are there any "not found" reports in configure output?

Barry


> 
> Thanks & Regards,
> Bhashkar
> 
> On Fri, Sep 25, 2020 at 12:43 PM Barry  > wrote:
> 
> 
>> On 25 Sep 2020, at 03:28, bhashkar prakash Singh > > wrote:
>> 
>> 
>> Hi Barry,
>> 
>> Thanks for your response.
>> 
>> I am not an expert in python code. Could you please elaborate a bit more on 
>> this.  Which cpython code are you referring to?
>> did you modify other files also apart from   _hashopenssl.c and _ssl.c to 
>> work with openssl-1.1.1g ?
> 
> Get the source of python.org  python 2.7.18 and you will 
> find that builds without patches against OpenSSL 1.1.1g.
> 
> I would then diff the C files that do not compile in stackless to look for 
> the required fixes.
> 
> Barry
> 
>> 
>> Regards,
>> Bhashkar
>> 
>> On Fri, Sep 25, 2020 at 2:40 AM Barry Scott > > wrote:
>> 
>> 
>> > On 24 Sep 2020, at 19:21, bhashkar prakash Singh > > > wrote:
>> > 
>> > Hi,
>> > 
>> > I am using stackless Python 2.7.9 in my project and openssl-1.0.2q.
>> > I just upgraded the Openssl  version to 1.1.1g, due to which python
>> > compilation started failing. So, I patched  _hashopenssl.c and _ssl.c file
>> > in Python Modules as per new openssl  to make compilation successful.
>> > But when I run my image on  target HW,  I am getting below errors.  It
>> > looks like Openssl 1.1.1g libraries are not linked to Python.
>> > I am struggling with this issue since many days. Looks like something I
>> > missed in my patching. Could someone please help on this.
>> 
>> I recently built python 2.7.18 against openssl 1.1.1g without issue.
>> Maybe look see what is in the cpython code that works fine.
>> 
>> Barry
>> > Thanks & Regards,
>> > Bhashkar
>> > -- 
>> > https://mail.python.org/mailman/listinfo/python-list 
>> > 
>> > 
>> 

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


Re: Logging lib doesn't work

2020-09-29 Thread Barry Scott



> On 29 Sep 2020, at 15:11, Alexandre FOURNEL 
>  wrote:
> 
> Hi all !
> 
> I'm trying to use logging lib in my python program. 
> 
> To try this lib, I am using basic code like : 
> 
> "import logging
> logging.basicConfig(filename='pont.txt', filemode='w',format='%(asctime)s 
> %(message)s', datefmt='%d/%m/%Y %H:%M:%S', level=logging.DEBUG)

Do you want to over write the file each run?
That is what 'w' says you want. Maybe try 'a' - append?

> logging.debug('This message should go to the log file')
> logging.info('So should this')
> logging.warning('And this, too')"
> 
> But between 2 execution, I have to open a new terminal to get new data in my 
> file pont.txt. Do you know why ? 

Each time you run it the time stamps change right?

Barry


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

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


Re: Logging lib doesn't work

2020-09-29 Thread Alexandre FOURNEL
Le mardi 29 septembre 2020 à 16:33:39 UTC+2, Barry Scott a écrit :
> > On 29 Sep 2020, at 15:11, Alexandre FOURNEL  
> > wrote: 
> > 
> > Hi all ! 
> > 
> > I'm trying to use logging lib in my python program. 
> > 
> > To try this lib, I am using basic code like : 
> > 
> > "import logging 
> > logging.basicConfig(filename='pont.txt', filemode='w',format='%(asctime)s 
> > %(message)s', datefmt='%d/%m/%Y %H:%M:%S', level=logging.DEBUG)
> Do you want to over write the file each run? 
> That is what 'w' says you want. Maybe try 'a' - append?
> > logging.debug('This message should go to the log file') 
> > logging.info('So should this') 
> > logging.warning('And this, too')" 
> > 
> > But between 2 execution, I have to open a new terminal to get new data in 
> > my file pont.txt. Do you know why ?
> Each time you run it the time stamps change right? 
> 
> Barry 
> 
> 
> > 
> > Thanks 
> > 
> > Alexandre 
> > -- 
> > https://mail.python.org/mailman/listinfo/python-list 
> >

If I use also "a" instead of "w", it doesn't work ...
It works only when I use a new terminal (I am using Spyder to code)
-- 
https://mail.python.org/mailman/listinfo/python-list


python if and same instruction line not working

2020-09-29 Thread pascal z via Python-list
I need to change the script commented out to the one not commented out. Why?

# for x in sorted (fr, key=str.lower):
# tmpstr = x.rpartition(';')[2]
# if x != csv_contents and tmpstr == "folder\n":
# csv_contentsB += x
# elif x != csv_contents and tmpstr == "files\n":
# csv_contentsC += x

for x in sorted (fr, key=str.lower):
if x != csv_contents:
tmpstr = x.rpartition(';')[2]
if tmpstr == "folder\n":
csv_contentsB += x
elif tmpstr == "file\n":
csv_contentsC += x
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: [RELEASE] Python 3.8.6 is now available

2020-09-29 Thread David Raymond
> Python 3.8.6 is the sixth maintenance release of Python 3.8. Go get it here:

> https://www.python.org/downloads/release/python-386/ 
> 


Just a quick note that there still seem to be a few places on the website which 
are still showing 3.8.5 as the latest release. (Looking at it with Firefox on 
Windows)

On the main page www.python.org it has 3.8.6 down in the latest news section, 
and a direct link in the little download box right above that. But if you hover 
over the big "Downloads" tab at the top it gives a big 3.8.5 button

If you click on that Downloads tab and go to www.python.org/downloads, again 
there's a big gold button for 3.8.5, and if you scroll down to the "Looking for 
a specific release?" section there is no 3.8.6 visible. The most recent line is 
3.5.10 from Sept 5th

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


Re: python if and same instruction line not working

2020-09-29 Thread MRAB

On 2020-09-29 15:42, pascal z via Python-list wrote:

I need to change the script commented out to the one not commented out. Why?

 # for x in sorted (fr, key=str.lower):
 # tmpstr = x.rpartition(';')[2]
 # if x != csv_contents and tmpstr == "folder\n":
 # csv_contentsB += x
 # elif x != csv_contents and tmpstr == "files\n":
 # csv_contentsC += x

 for x in sorted (fr, key=str.lower):
 if x != csv_contents:
 tmpstr = x.rpartition(';')[2]
 if tmpstr == "folder\n":
 csv_contentsB += x
 elif tmpstr == "file\n":
 csv_contentsC += x

You haven't defined what you mean by "not working" for any test values 
to try, but I notice that the commented code has "files\n" whereas the 
uncommented code has "file\n".

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


tkinter and input()

2020-09-29 Thread Pierre Bonville
 Hello everybody,
I have a small problem with the method .quit() of tkinter. Below is a
sketch of a much larger program, which shows the problem. I would like to
run the main program but keeping the tk window on the screen until the end.
Presently, execution stops after the first "plot" instruction. I don't
understand why. The program runs fine if one replaces "quit" by "destroy",
but then the tk window disappears. Is there a solution?
Thanks in advance for any answer,
Regards,
P.Bonville

# -*- coding: utf-8 -*-
import matplotlib.pyplot as plt
import numpy as np
from tkinter import *
def init():
global vit
def print_par():
global vitt
vitt = vit.get()
print("velocity= ",vitt," cm/s")
fen.quit()

vit = ""
fen = Tk()
vit0 = StringVar()
Label(fen, text = "velocity (cm/s): ").grid(row=0)
vit = Entry(fen,text = vit0)
vit0.set(7.)
vit.grid(row=0, column=1)
button = Button(fen, text='OK', command=print_par).grid(row=5,column=0)
fen.mainloop()

vit = float(vitt)

init()
print(vit)

x = np.arange(0,4*np.pi,0.1)
y = np.sin(x)

for i in range(0,10):
plt.plot(x,y)
plt.show()
re = input("Hit RETURN to continue:")
-- 
https://mail.python.org/mailman/listinfo/python-list


Problem

2020-09-29 Thread Ron Villarreal via Python-list
Tried to open Python 3.8. I have Windows 10. Icon won’t open.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: tkinter and input()

2020-09-29 Thread Terry Reedy

On 9/29/2020 9:48 AM, Pierre Bonville wrote:

I have a small problem with the method .quit() of tkinter.


What problem?  It works for me (3.9 on Win 10).

>>> import tkinter as tk
>>> r = tk.Tk()
>>> b = tk.Button(r, text= r.quit)
>>> b = tk.Button(r, text='quit', command=r.quit)
>>> b.pack()
>>> r.mainloop()  # This blocks until press button.
>>> # Root window with button is still displayed.

Your program has a lot more stuff extraneous to your question and 
requires matplotlib and numpy.


Posted code should be a minimal reproducible example such as above.

Try adding a few lines at a time until it breaks or does what you want.

--
Terry Jan Reedy

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