Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread boB Stepp
On Tue, Jun 1, 2021 at 12:20 PM Dennis Lee Bieber  wrote:
>
> On Tue, 1 Jun 2021 08:04:54 +1000, Cameron Simpson 
> declaimed the following:
>
> >On 30May2021 20:36, Dennis Lee Bieber  wrote:
> >>On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson 
> >>declaimed the following:
> >>>Open another terminal, note its terminal device with the "tty"
> >>>command.
> >>>Start your programme like this:
> >>>python .. 2>/dev/tty-of-the-other-termina
> >>>
> >>  The OP specified Win10, so the above is dead from the start.
> >
> >Good point; I wasn't aware that curses worked in Windows.
>
> https://docs.python.org/3/howto/curses.html
> "The Windows version of Python doesn’t include the curses module. A ported
> version called UniCurses is available."
>
> Appears the easiest is to PIP "windows-curses" then track down
> piecemeal installs (it is unclear if UniCurses includes PDCurses, or needs
> that as a separate install).

windows-curses 2.2.0 has been working well for me so far on Win10:
https://pypi.org/project/windows-curses/

"Adds support for the standard Python curses module on Windows. Based
on these wheels. Uses the PDCurses curses implementation."

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


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Jach Feng
pjfa...@earthlink.net 在 2021年5月31日 星期一上午1:42:43 [UTC+8] 的信中寫道:
> I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3 
> at that time), but could not figure out how to use it to debug a python 
> script that uses the curses module. 
> 
> Does anyone here know if winpdb-reborn or any other debugger can support 
> 2-window debugging for a python script that uses the curses module? It 
> seems to me that a 2-window debugging session is necessary for a python 
> script that uses the curses module because using curses takes over the 
> screen from which the script is started, so debugging output and script 
> output need to be in separate windows. 
> 
> I've been forced to use a logger to trace critical values and program flow 
> for errors in such a script. It works, but it is annoyingly slow to debug 
> that way. 
> 
> TIA for any advice or RTFM you can provide. 
> 
> Peter 
> --
I have no problem on using rpdb2 to debug a script which is based on curses.

My environment are:
Windows Vista, Python 3.4.4, rpdb2 of winpdb-1.4.8, 
curses-2.2-cp34-cp34m-win32.whl, snake.py

Everything are old, but it works:-)

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


Re: Definition of "property"

2021-06-01 Thread Greg Ewing

On 1/06/21 7:01 am, Alan Gauld wrote:

That was the point, the OP said it was a book about OOP.
Not a book about "OOP in Python".


In that case it would be best to avoid the word, or give
a definition of the way he's using it, making it clear
that it's not a universal definition. Python's definition
is somewhat unusual, and so would not be appropriate.

--
Greg

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Alan Gauld via Python-list
On 01/06/2021 21:18, Rich Shepard wrote:
> On Sun, 30 May 2021, Cameron Simpson wrote:
> 
>> I've only just started with pdb. As of Python 3.7 there's a builtin
>> function named breakpoint() which drops you into the debugger.


> I'm stuck with neither approach (pdb, print()) working. 


> The activitytypes.py module:
> 

> class ATMainWindow(qtw.QMainWindow):
> 
>  def __init__(self):
>  super().__init__()
> 
>  # Model/View here.
>  self.model = qts.QSqlTableModel(db=db) # for single table
>  self.model.setTable('activitytypes')
>  self.model.select()
> 
>  self.table = qtw.QTableView()
>  self.table.setModel(self.model)
> 
>  self.setFixedSize(qtc.QSize(800, 600))

Assuming this is the line you want to examine set a beakpoint just above
it using the function that Cameron mentioned

(Or just set a breakpoint on the init() from pdb...

Trying to use step/next to debug an event driven application
is next to impossible. set breakpoints on the methods that
get triggered by events then generate the event to reach
the breakpoint.

Or, as in this case, on the init if you want to examine
objects as they are created.

As a general rule if you have to hit next/step more
than half a dozen times in a row you are probably making
extra work for yourself!


>> $/development/business_tracker/activitytypes.py(29)()
> -> window = ATMainWindow()
> (Pdb) n
> False
>> $/development/business_tracker/activitytypes.py(30)()
> -> window.show()
> (Pdb) n
>> $/development/business_tracker/activitytypes.py(32)()
> -> app.exec_()
> (Pdb) n
> n
>> $/development/business_tracker/activitytypes.py(32)()->None
> -> app.exec_()
> (Pdb) n

I'm not sure why you got that twice.
I'd expect you to only see it once.

> 
> and there it sits. No (Pdb) prompt, nothing. And no printed statements.

It's waiting while the app runs and for you to terminate it.

> I'd appreciate recommendations on the process to find where the bug lives
> since I can't seem to find it with print() or line-by-line in pdb.

Use breakpoints, don't try to step through the code from the
beginning - there lies madness!

And for event handlers that get called a lot use conditional
breakpoints so that you only stop when you want to.

-- 
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


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


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Cameron Simpson
On 01Jun2021 19:48, Alan Gauld  wrote:
>On 31/05/2021 16:16, Grant Edwards wrote:
>> On 2021-05-30, Alan Gauld via Python-list  wrote:
>>> You are not alone. debugging curses is one of the biggest obstacles 
>>> to
>>> its use.
>>
>> Can't you just run the debugger in a different window and attach to
>> the process you want to debug? That's how one uses a debugger with
>> curses apps written in C/C++.
>
>That's how we did it when I used curses on VMS/Unix using C.

That's ok for C-level things - they're close to the metal. But this is 
Python, so such tools may well be poorly adapted.

>But I confess I didn't think you could attach any python
>debugger to another python session?

Dennis Lee Bieber wrote earlier in this thread:

 From http://heather.cs.ucdavis.edu/~matloff/winpdb.html
 """
 About Winpdb and RPDB2:

 The Winpdb package, by Nir Aides, is an excellent Python debugger. It 
is
 especially nice because it can handle the debugging of threads- and
 curses-based code. It is a remote debugger, meaning that it connects
 through the network to a remote site (which can be the same machine at
 which it is invoked, which is typical).

 RPDB2 is text-based, while Winpdb is a GUI front end to RPDB2.
 """

So it sounds like someone's done the hard work here. I can imagine it 
embeds a Python proxy in the app which can be remote controlled from the 
debugger client, but I'm just guessing wildly.

Cheers,
Cameron Simpson 
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Dennis Lee Bieber wrote:


I suspect you really should be stepping INTO the calls, not just
invoking the functions completely and going to the next LOCAL statement.



$ /development/business_tracker/activitytypes.py(1)()

-> import sys
(Pdb) s

$ /development/business_tracker/activitytypes.py(2)()

-> import logging
(Pdb) s
--Call--

(978)_find_and_load()

(Pdb) s

Now I'll go learn what this means.

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Ethan Furman wrote:


Well, you only had two logging statements in that code -- logging is like
print: if you want to see it, you have to call it:


Ethan,

Got it, thanks.

I believe my problem is with the datasource module. I'm focused on making it
work (using logging to confirm that it is doing so). Will report results
when they're available.

Regards,

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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman

On 6/1/21 1:42 PM, Rich Shepard wrote:

> When I run it this is the output:
> $ python activitytypes.py 2021-06-01 13:39:10,219 -DEBUG - Start of Program
> 2021-06-01 13:39:15,229 -DEBUG - End of Program

Well, you only had two logging statements in that code -- logging is like 
print: if you want to see it, you have to call it:

logging.info('start of xx procedure')
logging.info('spam = %s', spam) # note the comma and not actual 
%-interpolation

> Obviously I have much to learn about using python's logging capabilities.
> I'll keep looking.

I'm certainly not an expert, but this is how I do it:

from logging import INFO, getLogger, Formatter, handlers

logger = getLogger()
logger.setLevel(INFO)
_handler = handlers.TimedRotatingFileHandler(
virtualenv / 'var/log/openerp/continuous_sync_records.log',
when='midnight',
backupCount=30,
)
_formatter = Formatter('%(asctime)s %(funcName)-25s %(message)s')
_handler.setFormatter(_formatter)
logger.addHandler(_handler)
del _handler, _formatter

and then in my code:

logger.info('failure converting %r to %r', target_bmp_file, target_png_file)

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


Async requests library with NTLM auth support?

2021-06-01 Thread Albert-Jan Roskam
   Hi,
   I need to make thousands of requests that require ntlm authentication so I
   was hoping to do them asynchronously. With synchronous requests I use
   requests/requests_ntlm. Asyncio and httpx [1] look promising but don't
   seem to support ntlm. Any tips?
   Cheers!
   Albert-Jan
   [1] https://www.python-httpx.org/
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Ethan Furman wrote:


Sounds like a console issue. Try using `logging` with a file... you could
even use `print` with a file if you wanted to.


Ethan,

Not before using logging I found a reference/example page

and modified the module to this:

# activitytypes.py
import sys
import logging

from PyQt5 import QtWidgets as qtw
from PyQt5 import QtGui as qtg
from PyQt5 import QtCore as qtc
from PyQt5 import QtSql as qts

from datasource import db

logging.basicConfig(level=logging.DEBUG, format='%(asctime)s -%(levelname)s - 
%(message)s')
logging.debug("Start of Program")

class ATMainWindow(qtw.QMainWindow):

def __init__(self):
super().__init__()

# Model/View here.
self.model = qts.QSqlTableModel(db=db) # for single table
self.model.setTable('activitytypes')
self.model.select()

self.table = qtw.QTableView()
self.table.setModel(self.model)

self.setMinimumSize(qtc.QSize(800, 600))
self.setCentralWidget(self.table)


if __name__ == '__main__':
app = qtw.QApplication(sys.argv)
window = ATMainWindow()
window.show()
#sys.exit(app.exec())
app.exec_()

logging.debug("End of Program")

When I run it this is the output:
$ python activitytypes.py 
2021-06-01 13:39:10,219 -DEBUG - Start of Program

2021-06-01 13:39:15,229 -DEBUG - End of Program

Obviously I have much to learn about using python's logging capabilities.
I'll keep looking.

Thanks,

Rich




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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Tue, 1 Jun 2021, Rich Shepard wrote:


The QSize() statement is never reached.


Correction: the window is 800 x 600, but it's still empty.

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


Pandsa to Excel conversion issue

2021-06-01 Thread EK Esawi via Python-list
Hi All--


I am using Pandas to read an excel file which is very "dirty" and needs 
cleaning. I read the file via pandas and did not setup dtypes or converters 
hoping i can do so later.. When i run my code, most columns did come out as 
strings but i cannot convert them to float or integer using astype or pandas.to 
numeric method. Every time i tried, i get the same error listed below



Here is my code

import pandas as pd
import numpy as np

MyFile='C:/Users/Temp.xlsx'
df=pd.read_excel(io=MyFile, nrows=100)


The error message i get when i tried to convert a string like '22.3' via astype 
or pd.to_numeric is below


Unable to parse string "22." at position 0


Thanks in advance


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


Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 15:59, Dennis Lee Bieber wrote:
> On Sun, 30 May 2021 21:20:24 +0100, Alan Gauld via Python-list
>  declaimed the following:
> 
>> On 30/05/2021 17:57, Irv Kalb wrote:
>>> I am doing some writing (for an upcoming book on OOP), and I'm a little 
>>> stuck.  
>>
>> Oh dear, that's one of myt hot buttons I'm afraid!
>> I hope it really is about OOP and not about classes. Classes
>> are such a minor part of OOP that it is depressing how many

>   To me, OOP tends to be language specific... 

OOP is supposed to be a programming paradigm in the same way that
Functional or Logic programming are paradigms. Its all about
how you organise your code. It should be based on message
passing between autonomous agents(objects). Classes etc are
language constructs aimed at making OOP easier, but they
are not OOP. It's very easy to build a class/object based
program that is not in any way OOP (in fact I'd go as far
as to say the majority of such programs today come into
that category). It's also possible (but difficult!)
to build an OOP program without classes.

Incidentally, I'm not arguing that classes should not be used
in imperative programming, they can be very powerful there
too. Just that using classes is not necessarily OOP.

> Finding books on OOAD -- which should be language agnostic -- is 
> more difficult, and tend to turn into books about how to use 
> UML rather than how to analyze/design using OO.

That's a fairly modern phenomenon. Most of the early books about
OOAD were language agnostic - even when they used a language for
demonstration purposes.

Books like Grady Booch's classic OOAD, or Peter Coad's series
with Ed Yourdon. The so-called method wars. They all had their own
methodology, but mostly that was just diagrammatic variances. The
underlying techniques and resultant structures were the same.
(And hence the move to UML, which is just a notation - an
extremely useful one, although often abused through over
zealous application.)

Even Rumbaugh's OMT book was meant to be general OOD, although
IMHO it was the least OO of all of them being heavily based
on data modelling.

Sadly, there are very few books today that even attempt to
describe the difference between OOP and the more common
procedural programming paradigm. Discussions of OOP have
degenerated into discussions about OOPL features rather than
how to build worlds of objects passing messages to each other.

-- 
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


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


Re: Python app setup

2021-06-01 Thread Terry Reedy

On 5/31/2021 2:20 PM, Murali Pa wrote:

Hi,
I've installed latest version of Python 3.9.5 and downloaded for Windows.
Once I click on the Python app, I'm getting command screen
You are getting the Python interactive interpreter.  This is different 
from the system command line console/terminal in which you enter system 
commands.



and not sure on  the next action.


Enter a Python statement.  See the Python tutorial which explains.


could you please help me to fix this issue.


If you wish to run a python program in a file, you have to enter a 
command line in the system terminal, click on the file, or load the file 
in an IDE such as IDLE and run it from there.  See the chapter of the 
doc Using Python for your system.



Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
bit (AMD64)] on win32
Type "help", "copyright", "credits" or "license" for more information.
>>>


Enter the first line of a statement, or if using IDLE, a complete statement.


Disclaimer: The information in this email is the property of IBM and may
be IBM Confidential and privileged. It is intended solely for the
addressee. Access to this email by anyone else is unauthorized. If you are
not the intended recipient, any disclosure, copying, distribution or any
action taken in reliance on it is prohibited. If you receive this message
in error please notify the sender immediately and delete all copies of
this message.


When one sends a message to a mailing list or newsgroup, this is 
complete nonsense.  The 'addressee' is anyone and everyone in the world. 
 Try to avoid it if you can.



--
Terry Jan Reedy

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


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 16:16, Grant Edwards wrote:
> On 2021-05-30, Alan Gauld via Python-list  wrote:

>> You are not alone. debugging curses is one of the biggest obstacles to
>> its use.
> 
> Can't you just run the debugger in a different window and attach to
> the process you want to debug? That's how one uses a debugger with
> curses apps written in C/C++. 

That's how we did it when I used curses on VMS/Unix using C.

But I confess I didn't think you could attach any python
debugger to another python session?

> Or I add debugging printf calls which
> write to stderr and redirect stderr to a file.

I do use logging sometimes but its not as immediate
as seeing the messages in the application as you run it.

>> My approach is to define a status line at the bottom of my program and
>> write print statements into that window. Something like:
> 
> Why not just use the standard python logging facility and log to a
> file or another terminal window?

I find the immediacy of an in-window message much easier. Its like using
print() statements in a regular CLI application. Its there in front of
you, no other terminals to look at.


-- 
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


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


Re: Neither pdb or print() displays the bug

2021-06-01 Thread Ethan Furman

On 6/1/21 1:18 PM, Rich Shepard wrote:

> I'd appreciate recommendations on the process to find where the bug lives
> since I can't seem to find it with print() or line-by-line in pdb.

Sounds like a console issue.  Try using `logging` with a file... you could even 
use `print` with a file if you wanted to.

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


Re: python 3.9.5

2021-06-01 Thread Dan Stromberg
On Tue, Jun 1, 2021 at 10:12 AM Dennis Lee Bieber 
wrote:

> On Mon, 31 May 2021 02:15:28 -0500, said ganoune 
> declaimed the following:
>
>  is this the third one in the last week...
>
> Does the Python FAQ address contemporary FAQ's?

It seems like https://docs.python.org/3/faq/windows.html would be the place.
-- 
https://mail.python.org/mailman/listinfo/python-list


Neither pdb or print() displays the bug

2021-06-01 Thread Rich Shepard

On Sun, 30 May 2021, Cameron Simpson wrote:


I've only just started with pdb. As of Python 3.7 there's a builtin
function named breakpoint() which drops you into the debugger. I've never
been a big debugger person, historicly using print() and equivalent.
However, this makes it very easy to insert this call into a piece of code
instead of having to invoke one's programme in a special way.


I'm stuck with neither approach (pdb, print()) working. I moved the database
code to a separate module, datasource.py, and when I run the
activitytypes.py module (using pdb and having entered print() statements at
various places in both the datasource and activities modules all I get is a
small, empty window with the window title. The QSize() statement is never
reached.

The activitytypes.py module:

import sys
from PyQt5 import QtWidgets as qtw
from PyQt5 import QtGui as qtg
from PyQt5 import QtCore as qtc
from PyQt5 import QtSql as qts

from datasource import db

class ATMainWindow(qtw.QMainWindow):

def __init__(self):
super().__init__()

# Model/View here.
self.model = qts.QSqlTableModel(db=db) # for single table
self.model.setTable('activitytypes')
self.model.select()

self.table = qtw.QTableView()
self.table.setModel(self.model)

self.setFixedSize(qtc.QSize(800, 600))
self.setCentralWidget(self.table)


if __name__ == '__main__':
app = qtw.QApplication(sys.argv)
window = ATMainWindow()
window.show()
#sys.exit(app.exec())
app.exec_()

Running the module in pdb and using 'next' to step through it produces this
result:


$/development/business_tracker/activitytypes.py(29)()

-> window = ATMainWindow()
(Pdb) n
False

$/development/business_tracker/activitytypes.py(30)()

-> window.show()
(Pdb) n

$/development/business_tracker/activitytypes.py(32)()

-> app.exec_()
(Pdb) n
n

$/development/business_tracker/activitytypes.py(32)()->None

-> app.exec_()
(Pdb) n

and there it sits. No (Pdb) prompt, nothing. And no printed statements.

I'd appreciate recommendations on the process to find where the bug lives
since I can't seem to find it with print() or line-by-line in pdb.

TIA,

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


Re: Python app setup

2021-06-01 Thread Dan Stromberg
What you've got there is a REPL, or Read-Evaluate-Print-Loop. It's good for
quick little exploratory tests.

For actually writing code, most people would prefer to use PyCharm or
VSCode or IDLE. You may find that IDLE has come with your CPython install.
Personally, I prefer vim+syntastic+jedi, but I realize that's not
everyone's cup of meat.

If you have an application you want to install that is built on Python,
rather than write your own code, there will probably be a pip command you
can run, or a setup.py to use. If this is the case, let us know.

HTH.

On Tue, Jun 1, 2021 at 10:23 AM Murali Pa  wrote:

>Hi,
>I've installed latest version of Python 3.9.5 and downloaded for
> Windows.
>Once I click on the Python app, I'm getting command screen and not sure
> on
>the next action. could you please help me to fix this issue.
>Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
>bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>>>>
>Thanks,
>Murali PA
>
>
>Disclaimer: The information in this email is the property of IBM and may
>be IBM Confidential and privileged. It is intended solely for the
>addressee. Access to this email by anyone else is unauthorized. If you
> are
>not the intended recipient, any disclosure, copying, distribution or any
>action taken in reliance on it is prohibited. If you receive this
> message
>in error please notify the sender immediately and delete all copies of
>this message.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
>
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-06-01 Thread Eryk Sun
On 6/1/21, Jon Ribbens via Python-list  wrote:
>
> I already answered that in the post you are responding to, but you
> snipped it: You can tell something's definitely not a data attribute
> if you have to put brackets after its name to call it as a method to
> invoke its function or retrieve the value it returns.

I prefer to use the generic term "computed attribute", which doesn't
interfere with the use of "data" in Python's concept of a data
descriptor and instance data. All descriptors are accessed without
calling them. Usually a non-data descriptor returns a bound callable
object, such as a method. But it can return anything. For example,
take the following P descriptor type:

class P:
   def __get__(self, obj, cls):
   if obj is not None:
   return 42
   return self

class C:
   p = P()

obj = C()

>>> obj.p
42

The P type doesn't implement __set__ or __delete__, so it's not a data
descriptor. This means we can set instance data `p` that overrides the
computed attribute. For example:

>>> obj.p = 21
>>> vars(obj)
{'p': 21}
>>> obj.p
21

>>> del obj.p
>>> obj.p
42
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Python app setup

2021-06-01 Thread Igor Korot
Hi,

On Tue, Jun 1, 2021 at 12:25 PM Murali Pa  wrote:
>
>Hi,
>I've installed latest version of Python 3.9.5 and downloaded for Windows.
>Once I click on the Python app, I'm getting command screen and not sure on
>the next action. could you please help me to fix this issue.
>Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
>bit (AMD64)] on win32
>Type "help", "copyright", "credits" or "license" for more information.
>>>>

Congratulations!!
You successfully installed python onm your box.

Now you can start coding in python.

Thank you.

>Thanks,
>Murali PA
>
>
>Disclaimer: The information in this email is the property of IBM and may
>be IBM Confidential and privileged. It is intended solely for the
>addressee. Access to this email by anyone else is unauthorized. If you are
>not the intended recipient, any disclosure, copying, distribution or any
>action taken in reliance on it is prohibited. If you receive this message
>in error please notify the sender immediately and delete all copies of
>this message.
>
> --
> https://mail.python.org/mailman/listinfo/python-list
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread jak

Il 31/05/2021 02:36, Dennis Lee Bieber ha scritto:

On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson 
declaimed the following:



Open another terminal, note its terminal device with the "tty" command.
Start your programme like this:

python .. 2>/dev/tty-of-the-other-termina



The OP specified Win10, so the above is dead from the start.




OP can try this way on win10: write the debug information in a log file
and, from another console, open the same log file with an editor that
knows how to check the active status of the file (eg: notepad++), which
can automatically update the changes (you can remove the notification
for this action from the tab preferences).

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


Re: Definition of "property"

2021-06-01 Thread Jon Ribbens via Python-list
On 2021-06-01, Greg Ewing  wrote:
> On 1/06/21 2:34 am, Jon Ribbens wrote:
>>  From the outside, it's just a *data* attribute. Which, from the inside,
>> it isn't. Hence "pretending".
>
> But what is it about the external appearance that would make
> you think it's a data attribute, rather than some other kind
> of attribute?

I already answered that in the post you are responding to, but you
snipped it: You can tell something's definitely not a data attribute
if you have to put brackets after its name to call it as a method to
invoke its function or retrieve the value it returns.

> (I'm assuming that by "data attribute" you mean a piece of
> data that's stored directly in the object. If you mean
> something else, we might be talking at cross purposes.)

I mean it in the sense it is used by the Python documentation.
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: Definition of "property"

2021-06-01 Thread Greg Ewing

On 1/06/21 2:34 am, Jon Ribbens wrote:

 From the outside, it's just a *data* attribute. Which, from the inside,
it isn't. Hence "pretending".


But what is it about the external appearance that would make
you think it's a data attribute, rather than some other kind
of attribute?

(I'm assuming that by "data attribute" you mean a piece of
data that's stored directly in the object. If you mean
something else, we might be talking at cross purposes.)

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


Python app setup

2021-06-01 Thread Murali Pa
   Hi,
   I've installed latest version of Python 3.9.5 and downloaded for Windows.
   Once I click on the Python app, I'm getting command screen and not sure on
   the next action. could you please help me to fix this issue.
   Python 3.9.5 (tags/v3.9.5:0a7dcbd, May  3 2021, 17:27:52) [MSC v.1928 64
   bit (AMD64)] on win32
   Type "help", "copyright", "credits" or "license" for more information.
   >>>
   Thanks,
   Murali PA


   Disclaimer: The information in this email is the property of IBM and may
   be IBM Confidential and privileged. It is intended solely for the
   addressee. Access to this email by anyone else is unauthorized. If you are
   not the intended recipient, any disclosure, copying, distribution or any
   action taken in reliance on it is prohibited. If you receive this message
   in error please notify the sender immediately and delete all copies of
   this message.

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


Re: python 3.9.5

2021-06-01 Thread Terry Reedy

On 5/31/2021 3:15 AM, said ganoune wrote:

Just installed python 3.9.5 in my HP laptop, cant open it.
Laptop hp I3 running with windows 10.


You have to say a lot more.  How did you install, with what options? 
How do you try to 'open' (start) it?  What happens instead?



--
Terry Jan Reedy

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


Re: Definition of "property"

2021-06-01 Thread Alan Gauld via Python-list
On 31/05/2021 01:24, Greg Ewing wrote:
> On 31/05/21 8:20 am, Alan Gauld wrote:
>>
>> That's a very Pythonic description.
> 
> If it's a book about Python, it needs to be. The word "property"
> has a very specialised meaning in Python.
> 
> In some other languages it's used the way we use "attribute" in
> Python. So a Python-specific definition is necessarily going
> to be very different from a generic one.

That was the point, the OP said it was a book about OOP.
Not a book about "OOP in Python". The two are not synonymous.

If we go back to the very beginnings of OOP, properties were
defined as the publicly available state variables of the object.
(Some others favoured using "properties" to describe the entire
set of messages to which an object could respond).

In classification theory they are defined as "the essential
characteristics of an object that identify it with a class"
Some theorists also insist that such properties be immutable
after instantiation of the object.

The first could be considered quite close to what Python
does(or allows you to do) but the second is quite different!
Although properties can be used to create a form of immutablity.

-- 
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


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


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Grant Edwards
On 2021-05-31, Dennis Lee Bieber  wrote:
> On Mon, 31 May 2021 08:07:21 +1000, Cameron Simpson 
> declaimed the following:
>
>
>>Open another terminal, note its terminal device with the "tty" command.  
>>Start your programme like this:
>>
>>python .. 2>/dev/tty-of-the-other-termina
>
>   The OP specified Win10, so the above is dead from the start.

Perhaps Windows isn't an appropriate OS under which to develop curses 
applicatoins?

--
Grant



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


Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread Grant Edwards
On 2021-05-30, Alan Gauld via Python-list  wrote:
> On 30/05/2021 18:26, pjfarl...@earthlink.net wrote:
>> I tried winpdb-reborn some time last year on my Win10 system (python 3.8.3
>> at that time), but could not figure out how to use it to debug a python
>> script that uses the curses module.
>
> You are not alone. debugging curses is one of the biggest obstacles to
> its use.

Can't you just run the debugger in a different window and attach to
the process you want to debug? That's how one uses a debugger with
curses apps written in C/C++. Or I add debugging printf calls which
write to stderr and redirect stderr to a file.

> My approach is to define a status line at the bottom of my program and
> write print statements into that window. Something like:

Why not just use the standard python logging facility and log to a
file or another terminal window?

--
Grant

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


Re: Definition of "property"

2021-06-01 Thread Jon Ribbens via Python-list
On 2021-05-31, Greg Ewing  wrote:
> On 31/05/21 9:13 am, Jon Ribbens wrote:
>> No, I said it pretends to be a *data* attribute.
>
> I don't think it's pretending to be anything. From the outside,
> it's just an attribute.

>From the outside, it's just a *data* attribute. Which, from the inside,
it isn't. Hence "pretending".

> Data attributes are more common than non-data attributes, so
> we tend to assume that an attribute is a data attribute until
> told otherwise. But that's just our psychological bias, not
> because of any pretence on the part of properties.

None of that is true. You can tell something's definitely not
a data attribute if you have to put brackets after its name
to call it as a method to invoke its function or retrieve the
value it returns. Accessing a data attribtue is efficient and
has no side effects, unless someone's doing some unusual and
probably inadvisable hackery behind the scenes. Calling a method
can do literally anything.

> Also, there's a sense in which *all* attributes are properties.
> At the lowest level, all attribute accesses end up calling
> a method. It's just that in most cases the method is implemented
> in C and it looks up a value in the object's dict.

Sure, if we take the "lowest level" and pretend there are no
higher-level structures it's all just electrons doing apparently
random things and there's nothing more to be said about it.
-- 
https://mail.python.org/mailman/listinfo/python-list


[RELEASE] Python 3.10.0b2 is available

2021-06-01 Thread Pablo Galindo Salgado
After fighting with some release blockers, implementing a bunch of GC
traversal functions, and fixing some pending reference leaks, we finally
have Python 3.10.0 beta 2 ready for you! Thanks to everyone that helped to
unblock the release!

https://www.python.org/downloads/release/python-3100b2/

# This is a beta preview of Python 3.10

Python 3.10 is still in development. 3.10.0b2 is the second of four planned
beta release previews. Beta release previews are intended to give the wider
community the opportunity to test new features and bug fixes and to prepare
their projects to support the new feature release.

We **strongly encourage** maintainers of third-party Python projects to
**test with 3.10** during the beta phase and report issues found to [the
Python bug tracker](https://bugs.python.org/) as soon as possible. While
the release is planned to be feature complete entering the beta phase, it
is possible that features may be modified or, in rare cases, deleted up
until the start of the release candidate phase (Monday, 2021-08-02). Our
goal is to have no ABI changes after beta 4 and as few code changes as
possible after 3.10.0rc1, the first release candidate. To achieve that, it
will be **extremely important** to get as much exposure for 3.10 as
possible during the beta phase.

Please keep in mind that this is a preview release and its use is **not**
recommended for production environments.

The next pre-release of Python 3.10 will be 3.10.0b3, currently scheduled
for Thursday, 2021-06-17.

# And now for something completely different

The Ehrenfest paradox concerns the rotation of a "rigid" disc in the theory
of relativity. In its original 1909 formulation as presented by Paul
Ehrenfest in relation to the concept of Born rigidity within special
relativity, it discusses an ideally rigid cylinder that is made to rotate
about its axis of symmetry. The radius R as seen in the laboratory frame is
always perpendicular to its motion and should therefore be equal to its
value R0 when stationary. However, the circumference (2πR) should appear
Lorentz-contracted to a smaller value than at rest. This leads to the
apparent contradiction that R = R0 and R < R0.

# We hope you enjoy those new releases!

Thanks to all of the many volunteers who help make Python Development and
these releases possible! Please consider supporting our efforts by
volunteering yourself or through organization contributions to the Python
Software Foundation.

Regards from very sunny London,

Your friendly release team,
Pablo Galindo @pablogsal
Ned Deily @nad
Steve Dower @steve.dower
-- 
https://mail.python.org/mailman/listinfo/python-list


RE: How to debug python + curses? [was: RE: Applying winpdb_reborn]

2021-06-01 Thread pjfarley3
> -Original Message-
> From: Alan Gauld 
> Sent: Sunday, May 30, 2021 4:38 PM
> To: python-list@python.org
> Subject: Re: How to debug python + curses? [was: RE: Applying winpdb_reborn]
> 
> On 30/05/2021 18:26, pjfarl...@earthlink.net wrote:
> > I tried winpdb-reborn some time last year on my Win10 system (python
> > 3.8.3 at that time), but could not figure out how to use it to debug a
> > python script that uses the curses module.
> 
> You are not alone. debugging curses is one of the biggest obstacles to its 
> use.
> 
> My approach is to define a status line at the bottom of my program and write
> print statements into that window. Something like:
> 
> def main(stdwin):
> appwin = curses.newwin(...) # LINES-1 high
> status = curses.newwin(...) # 1 line high positioned on bottom
> # more code here
> status.addstr(0,0, "Value of foo = %s" % foo)
> 
> curses.wrapper(main)
> 
> After debugging the status window can either be retained as an application
> status bar or removed and the main window enlarged by one line...
> 
> If anyone else has found a better way to debug curses code I'm also keen to
> hear!

Thanks Alan, interesting idea.  And it will work whether you are running in a 
Windows system or a *ix one.

Peter

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