Re: Pre-Pre-PEP: The datetime.timedeltacal class

2022-04-18 Thread Barry
> On 18 Apr 2022, at 13:01, Peter J. Holzer wrote: > > On 2022-04-16 20:25:45 +0100, Barry wrote: >> Suggest that you start with the use cases that you want supported. >> Then you can turn them into a set of tests to check that the solution works. > > Writing test

Re: Why does datetime.timedelta only have the attributes 'days' and 'seconds'?

2022-04-19 Thread Barry
century is skip unless it’s a leap quadra century. Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Barry
e -0” will list the state of installed pythons. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to have python 2 and 3 both on windows?

2022-04-22 Thread Barry
> On 22 Apr 2022, at 18:43, Gisle Vanem wrote: > > Barry wrote: > >> Tip “py.exe -0” will list the state of installed pythons. > Not here; 'py.exe -0' gives: > Requested Python version (0) not installed > > Which PyInstaller version support this

Re: Verifying I installed Python correctly

2022-04-25 Thread Barry
thon as a command and it should work. py hello.py Barry > > *C:\Users\gd752>cd C:\google-python-exercises>* > *The syntax of the command is incorrect.* > > I installed version 3.10. I am stuck and could use some help. > Thx, > > > [image: directory pic.png] >

Re: Verifying I installed Python correctly

2022-04-25 Thread Barry
pic.png] > > Have you tried > > python3 hello.py Will not work on windows. Python is always installed as python.exe and py.exe only. Barry > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: tail

2022-05-07 Thread Barry
the handling of line endings and encodings yourself. It’s not that hard for the cases you wanted. Figure out which line ending is in use from the CR LF, LF, CR. Once you have a line decode it before returning it. The only OS I know that used CR was Classic Mac OS. If you do not care about that t

Re: tail

2022-05-08 Thread Barry
> On 7 May 2022, at 17:29, Marco Sulla wrote: > > On Sat, 7 May 2022 at 16:08, Barry wrote: >> You need to handle the file in bin mode and do the handling of line endings >> and encodings yourself. It’s not that hard for the cases you wanted. > >>>> &quo

Re: tail

2022-05-08 Thread Barry
> On 8 May 2022, at 20:48, Marco Sulla wrote: > > On Sun, 8 May 2022 at 20:31, Barry Scott wrote: >> >>>> On 8 May 2022, at 17:05, Marco Sulla wrote: >>> >>> def tail(filepath, n=10, newline=None, encoding=None, chunk_size=100): >>&g

Re: tail

2022-05-09 Thread Barry
> On 9 May 2022, at 17:41, r...@zedat.fu-berlin.de wrote: > > Barry Scott writes: >> Why use tiny chunks? You can read 4KiB as fast as 100 bytes > > When optimizing code, it helps to be aware of the orders of > magnitude That is true and we’ll know to me, now show

Re: tail

2022-05-09 Thread Barry
he middle of some character. And there are encodings >>>> where you cannot inspect the data to find a character boundary in the >>>> byte stream. >>> >>> Ooook, now I understand what you and Barry mean. I suppose there's no >>> reliable way to

Re: Convert the decimal numbers expressed in a `numpy.ndarray` into a matrix representing elements in fractional form

2022-05-16 Thread Barry
perations() > b=SymOp[1].affine_matrix.tolist() > > def strmat(m): > if(np.array([m]).ndim==1): > return str(Fraction(m)) > else: return list(map(lambda L:strmat(L), np.array(m))) > > lst=[] > for i in SymOp: > lst.append(i.affine_matrix.tolist()) > > a=st

Re: terminate called after throwing an instance of 'boost::python::error_already_set

2022-05-28 Thread Barry
it down? You will need to use a C++ level debugger to see which extension is crashing. gdb on linux, lldb on macOs or visual studio on windows. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to test characters of a string

2022-06-07 Thread Barry
k home work questions here and we try to teach a student with hints not finished answers. Your post was confused with a home work question. Barry > > >> On 7 Jun 2022, at 22:08, 2qdxy4rzwzuui...@potatochowder.com wrote: >> >>> On 2022-06-07 at 21:35:43 +0200, >&g

Re: installing

2022-06-11 Thread Barry
> On 10 Jun 2022, at 17:32, Yusuf Özdemir wrote: > >  ? My guess you attached an image, but this list does not allows attachements. Please copy and paste the text of the error for us to read. However you may find that this helps: https://docs.python.org/3/using/windows.ht

Re: Are there any benefits of a shared build python, compared to a static build python?

2022-07-20 Thread Barry
o do link time optimisation of python code. I think Debian starting doing this first and other distro followed after seeing the big performance improvement Debian got. Barry > > I found a related question on SO and is it like he said ( > https://stackoverflow.com/a/73035776/5983841), shared

Re: Why I fail so bad to check for memory leak with this code?

2022-07-22 Thread Barry
that will not be directly related to the python code you test. To put it another way there is noise in your memory allocation signal. Usually the signal of a memory leak is very clear, as you noticed. For rare leaks I would use a tool like valgrind. Barry > -- > https://mail.python.org/

Re: random.SystemRandom().randint() inefficient

2022-07-26 Thread Barry
OS that you are running on and its version? If it’s linux what is the kernel version? What version of python and where from? Barry > > -- > Cecil Westerhof > Senior Software Engineer > LinkedIn: http://www.linkedin.com/in/cecilwesterhof > -- > https://mail.python.org/mailm

Re: random.SystemRandom().randint() inefficient

2022-07-27 Thread Barry
> On 27 Jul 2022, at 17:09, Cecil Westerhof via Python-list > wrote: > > Barry writes: > >>>> On 26 Jul 2022, at 16:07, Cecil Westerhof via Python-list >>>> wrote: >>> >>> I need to get a random integer. At first I tried

Re: Simple TCP proxy

2022-07-27 Thread Barry
t more expensive the having kernel keep the connection in the listen socket backlog. I work on a web proxy written on python that handles huge load and using backlog of the bursts. It’s async using twisted as threads are not practice at scale. Barry > > Regards, > > Morten > >

Re: Simple TCP proxy

2022-07-28 Thread Barry
> On 28 Jul 2022, at 10:31, Morten W. Petersen wrote: > >  > Hi Barry. > > Well, I can agree that using backlog is an option for handling bursts. But > what if that backlog number is exceeded? How easy is it to deal with such a > situation? You can make backlog v

Re: How to generate a .pyi file for a C Extension using stubgen

2022-07-29 Thread Barry
o file without luck. It says that stubgen works on .py files not .so files. You will need to write the .pyi for your .so manually. The docs could do with splitting the need for .pyi for .so away from the stubgen description. Barry > -- > https://mail.python.org/mailman/list

Re: mailbox misbehavior with non-ASCII

2022-07-30 Thread Barry
om > X-DSPAM-Factors: a'b > > xxx > > ... but if the apostrophe in "a'b" is replaced with a > RIGHT SINGLE QUOTATION MARK, the returned h is of type > "email.header.Header", and seems to contain inscrutable garbage. Include in any bug report t

Re: How to generate a .pyi file for a C Extension using stubgen

2022-07-30 Thread Barry
> On 30 Jul 2022, at 10:30, Marco Sulla wrote: > > On Fri, 29 Jul 2022 at 23:23, Barry wrote: >> >> >> >>>> On 29 Jul 2022, at 19:33, Marco Sulla wrote: >>> >>> I tried to follow the instructions here: >>> >&

Re: Simple TCP proxy

2022-07-30 Thread Barry
hing the envelope on Python threading. You never did answer my query on why a large backlog is not good enough. Why do you need this program at all? Barry > > -Morten > > On Sat, Jul 30, 2022 at 12:59 PM Roel Schroeven > wrote: > >> Morten W. Petersen schreef op 29/07/

Re: PEP about recommended project folder layout

2022-07-30 Thread Barry
> On 30 Jul 2022, at 13:52, c.bu...@posteo.jp wrote: > > Isn't there a PEP? PEP are for improving python. They are not for telling people how to use python. I would be surprised to fine a PEP that addressed this. Barry > >> On 2022-07-26 07:14 c.bu...@posteo.jp wrote

Re: Which linux distro is more conducive for learning the Python programming language?

2022-08-04 Thread Barry
>> -- >> regards, >> kushal > > Noted with thanks Kushal. Since I can download FREE copies of RHEL > 9.0, I will use it then. I consider rhel 9 is an old os. I would suggest using fedora over rhel. Fedora 36 has python 3.10 and the when fedora 37 is released it will have python 3.11. And fedora is free as well. Barry > > Mr. Turritopsis Dohrnii Teo En Ming > Targeted Individual in Singapore > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Parallel(?) programming with python

2022-08-08 Thread Barry
nd >> Python Programming - John Zelle (2009). > When working with threads, you should use queues, not lists, because queues > do their own locking and can wait for items to arrive, with a timeout, if > desired: Lists do not need to be locked in python because of the GIL. However you

Re: Persistent Error: Python was not found

2022-08-14 Thread Barry
things that you may need to know about on windows. Barry > > I'm using a Windows 10, 64gb HP EliteBook. > > I've been trying to configure my laptop to run python scripts. > This is the error I keep getting: > Python was not found; run without arguments to install fro

Re: UTF-8 and latin1

2022-08-17 Thread Barry
#x27;) > > (I think latin-1 text will almost always fail to be decoded as utf-8, > so this would work fairly reliably assuming those are the only two > encodings you see.) Only if a reserved byte is used in the string. It will often work in either. For web pages it cannot be assumed that ma

Re: Mutating an HTML file with BeautifulSoup

2022-08-19 Thread Barry
o bs4 and hit the same issue. So no it will not output the same as went in. If you can trust the input to be parsed as xml, meaning all the rules of closing tags have been followed. Then I think you can parse and unparse thru xml to do what you want. Barry > > Using the Alice ex

Re: Python scripts in .exe form

2022-08-20 Thread Barry
able to get the > scripts from there. The temp file is only for .dll files the python code is in a data block that is appended to the .exe stub. There are tools that can grab the appended dat and dump it out. Or atleast should be. Barry > > Sent from my iPhone > >> On Aug 19,

Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Barry
> On 19 Aug 2022, at 22:04, Chris Angelico wrote: > > On Sat, 20 Aug 2022 at 05:12, Barry wrote: >> >> >> >>>> On 19 Aug 2022, at 19:33, Chris Angelico wrote: >>> >>> What's the best way to precisely reconstruct an HTML file

Re: Mutating an HTML file with BeautifulSoup

2022-08-21 Thread Barry
> On 21 Aug 2022, at 09:12, Chris Angelico wrote: > > On Sun, 21 Aug 2022 at 17:26, Barry wrote: >> >> >> >>>> On 19 Aug 2022, at 22:04, Chris Angelico wrote: >>> >>> On Sat, 20 Aug 2022 at 05:12, Barry wrote: >>>>

Re: ImportError: No module named spambayes.resources (line 12 of setup_all.py)

2022-08-24 Thread Barry
to execute the thing that's failing. On fedora I still use spambayes and it works great, but I have it running under python 2.7. never did take on a port to python 3 I will have to consider that when python 2 finally is removed from fedora, or use something else. Barry > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
ring is computed before the log call. Maybe you are thinking of the lazy expression idea for this. That idea seems to have got no where as its not clear how to implement it without performance issues. Barry > > Skip > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
x27;s not gone >> anywhere (yet). > Letting you pass in a callable to call might help because that you could use > lambda. Yep, that’s the obvious way to avoid expensive log data generation. Would need logging module to support that use case. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Ref-strings in logging messages (was: Performance issue with CPython 3.10 + Cython)

2022-10-07 Thread Barry
ebug = logger_from(DEBUG) log_debug and log_debug(‘expensive %s’ % (complex(),)) Barry > > From: Python-list on > behalf of Barry > Date: Friday, October 7, 2022 at 1:30 PM > To: MRAB > Cc: python-list@python.org > Subject: Re: Ref-strings in logging messages (was: Pe

Re: What to use for finding as many syntax errors as possible.

2022-10-09 Thread Barry
ame so high it was useless trying to find the > remaining true ones, but it still was more efficient to correct the > obvious ones, than to only correct the first one. If it’s very fast to syntax check then one at a time is fine. Python is very fast to syntax check so I personal do not

Re: Find the path of a shell command [POSTPONED]

2022-10-16 Thread Barry
t of the script >> >> and have a look afterwards. Cron's environment is very minimal. This >> will show you what's in it. >> > > Careful. On some systems if someone restarts the cron daemon, it could > pick up a larger environment than after bein

Re: str.replace() when str contains \

2022-10-29 Thread Barry
uot;H:\a2023"; print(a.replace("\\","/")) > H:2023 >>>> a="H:\_2023"; print(a.replace("\\","/")) > H:/_2023 String a does not quote the \ after :. You need “H:\\2023” etc. check what a is before the replace with a print(repr(a)) Barry > > Best regards, > Bernard LEDRU > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: How to manage python shebang on mixed systems?

2022-11-07 Thread Barry
me-named local link and > put that in your shebang? > > #!~/scripts/mypython I do not think ~ works in a #! line. The ~ is handled by the shell, like bash. But the #! Is handled by the kernel in it exec() handling I recall. Using /usr/local/bin may be more suitable. Otherwise you are for

Re: Python 3.7+ cannot print unicode characters when output is redirected to file - is this a bug?

2022-11-13 Thread Barry
n > Windows? Your other thread has a reply that explained this. It is a problem with windows and character sets. You have to set things up to allow Unicode to work. Barry > > Jessica > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: Are these good ideas?

2022-11-14 Thread Barry
a class you can add accessor methods that allow you to run debug code as values are changed. Also you can check that values being set are spelt correctly, have reasonable values etc. Barry > The only potential problem is in documenting the key/value pairs the > dictionary is supposed

Re: Debugging Python C extensions with GDB

2022-11-14 Thread Barry
3_9). > > > My question is: with Python 3.9+, can I debug into a C extension written in > pure C and called from ctypes -- that is not written using the C_API? Yes. Just put a breakpoint on the function in the c library that you want to debug. You can set the breakpoint before a .so

Re: Are these good ideas?

2022-11-14 Thread Barry
> On 14 Nov 2022, at 22:49, Chris Angelico wrote: > > On Tue, 15 Nov 2022 at 09:38, Barry wrote: >> >> >> >>>> On 14 Nov 2022, at 22:06, Thomas Passin wrote: >>> >>> For parameter passing like your #2, I have packaged them in

Re: Debugging Python C extensions with GDB

2022-11-15 Thread Barry
out a specific use of gdb for python c extensions. Barry > > > Nov 14, 2022, 14:32 by ba...@barrys-emacs.org: > > On 14 Nov 2022, at 19:10, Jen Kris via Python-list > wrote: > > In September 2021, Victor Stinner wrote “Debugging Python C extensions with > GDB”

Re: Passing information between modules

2022-11-21 Thread Barry
> should explicitly support clients substituting a custom > implementation to be used for "PRINT". What's the best way > for the client to "pass" his custom implementation to the > library (which is a package or a module)? Each place you have PRINT you need to have context.print calls. You said above that you have, or had, such an object - pass it around and use it. If passing it around is the problem then you need to look at why you code has that problem. Barry > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Python 3.11.0 installation and Tkinter does not work

2022-11-22 Thread Barry
Python before and accidentally have opened that version, > which may not include tkinter. In which case the error is module not found. The error reported suggests that a dll that _tkinter needs is missing. Barry > > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Calling pselect/ppoll/epoll_pwait

2022-12-02 Thread Barry
quot;non-p" variants. > > [1] https://docs.python.org/3/library/select.html > [2] https://docs.python.org/3/library/selectors.html Can you use signalfd and select/poll/epoll? Barry > > -- > >

Re: Calling pselect/ppoll/epoll_pwait

2022-12-04 Thread Barry
. Barry   From: Python-list on behalf of Barry Date: Friday, December 2, 2022 at 7:02 PM To: Ian Pilcher Cc: python-list@python.org Subject: Re: Calling pselect/ppoll/epoll_pwait *** Attention: This is an external email. Use caution responding, opening

Re: Contributing to cpython

2022-12-06 Thread Barry
about how to modify the code > as per the issue. Could you please help me with this? no one can help as you have not explained what the issue is. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: FTP without username and password

2022-12-07 Thread Barry
gt; Have a nice day! > ^Bart TFTP server and client tools are standard on linux systems. Barry > > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: pip/setuptools: Entry points not visible from pkexec-root-environment

2022-12-18 Thread Barry
> > So what can I do? Why are asking on this list and discuss.python.org? Lots of people on this list are also on discuss.python.org. Barry > > I don't need a hack or workaround but an "elegant" solution. > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to enter escape character in a positional string argumentfrom the command line?

2022-12-21 Thread Barry
icated cases, yeah, it can be. But in > the simple cases? Bash rocks. I see bash scripts that are 1000’s of line of code at work and its a maintenance nightmare. Knowing when to make the move from “handy bash script” to “this is a production application” and needs to be python is what I see people miss. After a certain point in complexity the python code wins on maintenance. Personally i set a low bar to move from bash to python. Barry > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Pyserial problem

2022-12-22 Thread Barry
> > I'm a bit surprised and stucked. > Can someone help ? Please post tour code that you are using to talk to the device. Barry > Thanks, > -- > Patrick Egloff > email : pegl...@gmail.com > Web page : http://www.egloff.eu > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Question.

2023-01-08 Thread Barry
> On 8 Jan 2023, at 21:20, Angitolol36 wrote: > >  Hello, i installed phyton in Windows 10 22H2 and i can’t find the program. > I used the repair that doesnt work. Does this help? https://docs.python.org/3/using/windows.html Barry > > > > > >

Re: Suggestion: Regex string specifier like r and f

2023-01-08 Thread Barry
know if this is feasible). This is unlikely to be implemented. See https://discuss.python.org/t/allow-for-arbitrary-string-prefix-of-strings/19740/12 for related idea discussion. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: HTTP server benchmarking/load testing in Python

2023-01-26 Thread Barry
ish not 100C. The max you see is the operating temp of the CPU. For intel CPU if you go beyond what the slow clocking can deal with the CPU turns itself off to prevent damage. Intel did this to stop people asking for replacement parts when there cooling was at fault. Barry > > Maybe five or

Re: Python: How to use the 'trace' module programmatically?

2023-02-16 Thread Barry
to do either add the outfile to trace or generate and write the report after runfunc returns. I have not tested this, just read the docs out of curiosity Here https://docs.python.org/3/library/trace.html Barry > def inner(): >print("Callee here.") > > Now I launched the program an

Re: Introspecting the variable bound to a function argument

2023-02-22 Thread Barry
There is the traceback module that lets you find where you are called from. Also there is the inspect module that also lets tou get at the stack in more detail. Barry > > -- > () ascii ribbon campaign -- against html e-mail > /\ www.asciiribbon.org -- against proprietary at

Re: Why doesn't Python (error msg) tell me WHAT the actual (arg) values are ?

2023-02-23 Thread Barry
27;t do the very > obvious and easy thing > of giving me this info: > >attempt to call + with 'abc' , > 123.45 <-- It is not easy to do that in a robust and reliable way for any object. You can end up in the code to generate the error message itself breaking. For example using unbounded CPU time when attempting to get the string repr of the variable. Barry > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a more efficient threading lock?

2023-02-25 Thread Barry
Re sqlite and threads. The C API can be compiled to be thread safe from my Reading if the sqlite docs. What I have not checked is how python’s bundled sqlite is compiled. There are claims python’s sqlite is not thread safe. Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: Is there a more efficient threading lock?

2023-02-28 Thread Barry
s to build the int value. And some compilers indeed do, the linux kernel folks see this in gcc generated code. I understand you have to use the new atomics features. Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: Bug 3.11.x behavioral, open file buffers not flushed til file closed.

2023-03-06 Thread Barry
d to the medium. WHQL? That had the effect of stooping driver manufactures having firmware to win benchmarking. Now the OS will use the commands to the drive that allow the OS to know the data is safe. Barry > > -- > Greg > -- > https://mail.python.org/mailman/listinfo/python-li

Re: Winodws10 Command Prompt unresponsive to .py commands

2023-03-07 Thread Barry
. you can then right-click the .py file and choose whichever program you > like to open with. Use py.exe which should in the windows folder to run .py files. Barry > I'm inclined to advise you to focus on getting virtual environments working > next and leave all that auto-opening to late

Re: PyGILState_Release called twice in embedded application

2023-03-23 Thread Barry
> On 23 Mar 2023, at 14:34, Arnaud Loonstra wrote: > > On 23-03-2023 13:33, Barry Scott wrote: >>>> On 23 Mar 2023, at 08:46, Arnaud Loonstra wrote: >>> >>> Hi all, >>> >>> I'm running in a crash due to a ResourceWarning (

Re: found older version of python in my command prompt

2023-03-28 Thread Barry
on 3.11 from python.org and run the installer. In a cmd terminal window run py.exe and you should get the python prompt. Barry > > > > References > > Visible links > 1. https://go.microsoft.com/fwlink/?LinkId=550986 > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: built-in pow() vs. math.pow()

2023-03-30 Thread Barry
's called math.pow. That on its own should be a strong indication > that it's designed to work with floats. So long as you know that the math module is provided to give access the C math.h functions. Barry > > ChrisA > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Problem in using libraries

2023-04-03 Thread Barry
ot;. You need to provide enough details for people to help you. Include which OS you are using. Where you got python from. How you installed the libraries you are trying to use. Commands and error messages you are seeing. Barry > -- > https://mail.python.org/mailman/listinfo/pytho

Re: Windows installer from python source code without access to source code

2023-04-04 Thread Barry
o C++. Once you have that installed there are bat files that setup environment in the terminal. Then you can use cl, nmake etc Barry > > -Original Message- > From: Eryk Sun > Sent: Friday, March 31, 2023 12:55 PM > To: Jim Schwartz > Cc: python-list@python.org > S

Re: for a 'good python'

2023-04-12 Thread Barry
adcast}") >print(f"mask: {sn.mask}") >print(f"wildcard: {sn.wildcard}") >print(f"host_min: {sn.host_min}") >print(f"host_max: {sn.host_max}") >print(f"Avaible hosts: {sn.hosts_num}") >print(f"Class: {sn.net_class}") > >tst_hdr = '10.0.0.31' >is_not = 'is ' >if not tst_hdr in sn: >is_not = 'is NOT ' >print("hdr %s %sin range %s - %s" % > (tst_hdr, is_not, sn.host_min, sn.host_max)) > > if __name__ == '__main__': >main() There is this https://docs.python.org/3/howto/ipaddress.html if you just want a solution. Or are you after code review feedback? Barry > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: for a 'good python'

2023-04-13 Thread Barry
 > On 13 Apr 2023, at 00:19, jak wrote: > > Barry ha scritto: >>  >>>> On 12 Apr 2023, at 18:10, jak wrote: >>> Hi everyone, >>> some time ago I wrote a class to determine if an ipv4 address belonged >>> to a subnet. Seldom using pytho

Re: Is npyscreen still alive?

2023-04-21 Thread Barry
/npcole/npyscreen > which returns a 404. > > There seems to be a copy in Github at > https://github.com/npcole/npyscreen/commits/master, > but the last commit was almost 4 years ago. > > Maybe it "just works" and is suitable for production? Maybe this, recently lwn.

Re: pip module not found

2023-05-12 Thread Barry
ystems: > > sudo apt-get install python3-tk > > For the Yum package manager: > > yum install tkinter > > You may also need to install ImageTk: > > sudo apt-get install python3-pil.imagetk (Debian-based) > > On Centos/Red Hat derived systems, you will also nee

Re: pip module not found

2023-05-12 Thread Barry
> On 12 May 2023, at 21:59, Thomas Passin wrote: > > On 5/12/2023 2:42 AM, David John wrote: >> Hi, >> I recently have been experiencing issues with the pip installation module. >> I have python version 3.11 installed. I've checked the directory installed >> in the systems variables window and

Re: PythonPath / sys.path

2023-05-14 Thread Barry
the net for an answer but only got what I had already tried > > any pointers what I'm doing wrong (other than using windows '->) I take it you have business reasons to use an obsolete version python. Where did you get your version of python from? You seem to be doing the righ

Re: PythonPath / sys.path

2023-05-15 Thread Barry
e. Being a Fedora user i needed to learn how to install missing pieces of pyrhon on ubuntu. We searches for: ubuntu install pip Ubuntu install idle Both provide lots of answers. Did your searches fail to turn up answers? Barry > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: Pip Error

2023-05-17 Thread Barry
changes that > could have caused this issue, but found none. I'm uncertain about the cause > of this error and how to resolve it. Any insights or suggestions would be > greatly appreciated. > > Thank you in advance for your assistance! Pip is installed by default with the pyt

Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
handleError("PyImport_Import()"); > } > } > } > void handleError(const char* msg) > { > ... > "PyImport_Import() - ImportError('Error: Reinit is forbidden')" > } You do not seem to printing out msg, you have assumed it means reinit it seems. What does

Re: Help on ImportError('Error: Reinit is forbidden')

2023-05-18 Thread Barry
On 18 May 2023, at 13:56, Jason Qian wrote:  Hi Barry, void handleError(const char* msg) { ... PyErr_Fetch(&pyExcType, &pyExcValue, &pyExcTraceback); PyErr_NormalizeException(&pyExcType, &pyExcValue, &pyExcTraceback);

Re: Why does IDLE use a subprocess?

2023-05-30 Thread Barry
e subprocess. You can crash idle with bugs in the code that you are developing. By running your code in a subprocess idle protects itself, and your edits from bugs in your code. Also if your code use tk then it would conflict with idle’s use of tk. That is my assumption on why the subprocess is

Re: complaint

2023-05-30 Thread Barry
ft app store stubs for python? The python.org uninstall always works in my experience, but is not related to the app store stubs. Also why do you think you need to reinstall python? It would be very unusual that that would be necessary. Barry > -- > https://mail.python.org/mailman/listinfo/p

Re: advice on debugging a segfault

2021-01-17 Thread Barry
Run python under gdb and when the segv happens use the gdb bt command to get a stack trace. Also if gdb says that it needs debug symbols install you will need to do that. Otherwise the not will not contain symbols. Barry > On 17 Jan 2021, at 19:58, Robin Becker wrote: > > I have a

Re: list() strange behaviour

2021-01-23 Thread Barry
assign a new generate into the variable that is used to access the generator. The avoids the need for the complications of reset logic. Barry > > I mean if you have a generator with initial conditions that change as it > progresses, could it cache away those initial conditions and upon

Re: IDE tools to debug in Python?

2021-02-06 Thread Barry
letely free, downloadable from SourceForge, 32 >> or 64 bit versions (must match your Python type). > > Windows only. See https://github.com/pyscripter/pyscripter/tree/master/Install It says use the zip file non windows. I have not tested this. Barry > > -- > Grant > &

Re: Why assert is not a function?

2021-03-02 Thread Barry
e with expression be evaluated. So you can safely do expensive things I the expression with incuring and cost if the condition is True. With a function assert the 2nd part would have to evaluated regardless of the state of the condition. Which would slow down the code for no benefit.

Re: Application problems

2021-03-11 Thread Barry
t; > (I just tested it on a clean VM and that's not what happens, but maybe for > some people? I dunno I think it is as simple as the python installer does not have the string “setup” in the name. I raise a bpo that is getting worked to change this hopefully for 3.10 maybe 3.11. Bar

Re: memory consumption

2021-04-01 Thread Barry
reduce their performance. Assuming this a modern linux then you should have control groups that allow you to set limits on memory and swap for each container. Are you running with systemd? Barry > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

Re: memory consumption

2021-04-01 Thread Barry
y, that a forceful constraint whilst running would crash the container? > > How else could one approach it? > I was responding to the assertion that adding swap to the system would impact other containers. The solution I have used is to set service/container resource limits to ensure they work as expected. I was not suggestion this a fix for the memory leak. Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: Current thinking on required options

2021-04-19 Thread Barry
users to apply operation to >-g GROUP, --group GROUP > group to apply operation to > > However, the options -o, -u, and -g are required, not optional. You could use positional args like this: grocli check user,user group Barry > > The documen

Re: Determine what the calling program is

2021-04-19 Thread Barry
true. OTOH, mkdir's easy to debug if it hangs around. Only the fcntl method is robust. Your suggestion with mkdir is not reliable in practice. If you need a lock in the sh env then there are standard patterns using the flock command. See the man page for examples. Barry > > Cheers, > Cameron Simpson > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: How to check if an image contains an element I am searchig for

2021-06-16 Thread Barry
> On 16 Jun 2021, at 21:46, Arak Rachael wrote: > > On Wednesday, 16 June 2021 at 22:08:31 UTC+2, Chris Angelico wrote: >>> On Thu, Jun 17, 2021 at 6:06 AM Arak Rachael wrote: >>> >>> Hi guys, >>> >>> I have an image from google maps to say and I need to check if it has road >>> markings

Re: How Do I Get A Bug In Multiprocessing Fixed?

2021-06-17 Thread Barry
Also you report requires any developer to write a program from you notes to reproduce the problem. Attach a program that shows the problem would help. Better yet diagnose the problem after you reproduce it with a fix in a PR. Barry > On 18 Jun 2021, at 06:07, Alexander Neilson wr

Re: Python for Android

2021-07-22 Thread Barry
 > On 19 Jul 2021, at 18:43, Bischoop wrote: > >  > Will Python delevopment apps for Android OS getting easier? > So far best option is Kivy which is not liked by many developers, > another option is PyQT5, which finally gets some support but there still > are some buts.. > Tkinter, some trie

Re: annotations cause dataclass fields type side effects

2021-08-10 Thread Barry
ent. Hopefully someone with a deeper understanding will explain how you do this. I would guess use eval. This is a known problem and there are core devs that are working on improvements. But it will be at leas python 3.11 before there is a possible improvement. Barry > > Thanks, > -- Lukas > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: basic auth request

2021-08-17 Thread Barry
> On 17 Aug 2021, at 19:25, Chris Angelico wrote: > > On Wed, Aug 18, 2021 at 4:16 AM Barry Scott wrote: >> Oh and if you have the freedom avoid Basic Auth as its not secure at all. >> > > That's usually irrelevant, since the alternative is most likely

Re: PyQt5 is not recognized from python 3.8 installation in python 3.10

2021-08-23 Thread Barry
can make some progress by adjusting some > paths? Only trivial C code extensions can be built on windows. And then only if you have the right MSVC tools installed. Most interesting extensions have dependencies only other software. Which means that you need to know how to build all the dependencies a

Re: basic auth request

2021-08-25 Thread Barry
help the attacker unless they can make a cert that signs the dns name. And that means they hacked the CA which is a big problem. Barry > > Elijah > -- > or a clever infosec name now forgotten > > -- > https://mail.python.org/mailman/listinfo/python-list > -- https://mail.python.org/mailman/listinfo/python-list

Re: on the popularity of loops while and for

2021-08-29 Thread Barry
se for. Of course you can use while instead of for but in code review that will get queried. Barry > -- > https://mail.python.org/mailman/listinfo/python-list -- https://mail.python.org/mailman/listinfo/python-list

  1   2   3   4   5   6   7   >