Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 04/01/2023 06:46, Chris Angelico wrote: I've known some systems to have a trigger of "reading on FD 0 flushes FD 1" C++ has this feature: Quote from https://en.cppreference.com/w/cpp/io/cin "Once |std::cin| is constructed, std::cin.tie() returns &std::cout

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 03/01/2023 21:24, c.bu...@posteo.jp wrote: Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main quest

Re: What should go to stdout/stderr and why Python logging write everything to stderr?

2023-01-04 Thread Barry Scott
On 03/01/2023 21:24, c.bu...@posteo.jp wrote: Am 03.01.2023 17:51 schrieb r...@zedat.fu-berlin.de: logging.getLogger().addHandler( logging.StreamHandler( sys.stdout )) But I don't want to make all log levels go to stdout. Just DEBUG and INFO. But this would be a workaround. The main quest

Re: file.read Method Documentation (Python 2.7.10)

2023-01-09 Thread Barry Scott
On 09/01/2023 14:34, Stephen Tucker wrote: Dear Python-list, Yes, I know that Python 2.x is no longer supported. I have found that the documentation for this method is misleading when the file being read is UTF-8-encoded: Instead of reading *size* bytes, the method reads *size *UTF-8 byt

Re: Is there a more efficient threading lock?

2023-02-26 Thread Barry Scott
On 25/02/2023 23:45, Jon Ribbens via Python-list wrote: I think it is the case that x += 1 is atomic but foo.x += 1 is not. No that is not true, and has never been true. :>>> def x(a): :...    a += 1 :... :>>> :>>> dis.dis(x)  1   0 RESUME   0  2   2 LOAD_FAST

Re: PyGILState_Release called twice in embedded application

2023-03-23 Thread Barry Scott
> On 23 Mar 2023, at 08:46, Arnaud Loonstra wrote: > > Hi all, > > I'm running in a crash due to a ResourceWarning (some socket is not closed in > a used module) after calling PyGILState_Release. > > I'm running Python in a native thread (so a thread created by C not Python). > I'm acquiri

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

2023-03-30 Thread Barry Scott
> On 30 Mar 2023, at 10:15, Andreas Eisele wrote: > > I sometimes make use of the fact that the built-in pow() function has an > optional third argument for modulo calculation, which is handy when dealing > with tasks from number theory, very large numbers, problems from Project > Euler, et

Re: Python not showing correct version

2023-03-30 Thread Barry Scott
> On 30 Mar 2023, at 15:17, Sumeet Firodia wrote: > >> >> Hi Team, >> >> I have installed Python 3.8 for Snowpark but when I check the version in >> command prompt it shows me Python 3.10.10. >> >> C:\Users\admin>python --version >> Python 3.10.10 Try this: py -3.8 And this to list all v

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

2023-03-30 Thread Barry Scott
> On 30 Mar 2023, at 18:11, Barry Scott wrote: > > > >> On 30 Mar 2023, at 10:15, Andreas Eisele wrote: >> >> I sometimes make use of the fact that the built-in pow() function has an >> optional third argument for modulo calculation, which is handy whe

Re: Python not showing correct version

2023-03-31 Thread Barry Scott
ause of this I am not able to proceed with next steps. > > Thanks > Sumeet > > On Thu, 30 Mar 2023 at 22:45, Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: >> >> >>> On 30 Mar 2023, at 15:17, Sumeet Firodia >> <mailto:ssfiro...@gmail.com&

Re: Python not showing correct version

2023-04-01 Thread Barry Scott
> On 31 Mar 2023, at 22:02, Eryk Sun wrote: > > > The OP installed the standard Python 3.8 distribution, which does > install the launcher by default. The launcher can run all installed > versions, including store app installations. By default it runs the > highest available version, which wi

Re: Windows Gui Frontend

2023-04-01 Thread Barry Scott
> On 1 Apr 2023, at 18:47, Igor Korot wrote: > > I suggest going with wxPython/wxGlade. I ported all my wxPython code to PyQt and have not regretted it. wxPython was (its been a while so may not be an issue now) far to hard to make consistent across OS, my apps run on Linux, macOS and Window

Re: Silly (maybe) question re imported module(s)

2023-05-19 Thread Barry Scott
> On 19 May 2023, at 07:44, Grizzy Adams via Python-list > wrote: > > Morning All > > I'm working through the tutorial and running / saving work that I wish to > keep > and build on, most times I can save and (re)import later with no difference > to > when typed in console or editor and

Re: Exploring terminfo

2021-01-14 Thread Barry Scott
> On 14 Jan 2021, at 16:12, Alan Gauld via Python-list > wrote: > > During lockdown I've been digging deeper into the curses module > and lately into the ti family of functions that reside there. > > I've written a short program that is supposed to > - *clear the screen*, > - read some i

Re: Question - problem downloading Python

2021-01-14 Thread Barry Scott
> On 14 Jan 2021, at 06:52, christine tiscareno wrote: > > I installed in my lap-top your latest version of Python (3.9.1), yet when I > go to cmd.exe to check, I get that I have Python 22.7.17 ??? > > Why? What should I do to get the latest version? > > I tried going back to fix problem

Re: sqlite3 cannot detect the version of compiled sqlite version at some point in runtime.

2021-01-20 Thread Barry Scott
> On 20 Jan 2021, at 19:54, panfei wrote: > > System environment: > > Cent OS 7 > Sqlite3 3.34.0 (Compile from source) > Python 3.9.1 (Compile from source) > Django 3.1.5 (Pip install) > > > 1. Compile sqlite3: > ./configure --prefix=/home/felix/.local/sqlite/sqlite-3.34.0 > make && make in

Re: c bindings with non-python thread callback while python exits

2021-01-26 Thread Barry Scott
> On 26 Jan 2021, at 14:35, Paul Grinberg wrote: > > I have a C++ library (luckily with source code, so I know what's going on) to > which I wrote c bindings. The library internally starts an event pthread > which generates callbacks back into python. The c binding for processing > these ca

Re: imalib cant get From: adresses

2021-01-27 Thread Barry Scott
Sigh you use a damaged email address for reply does not work. > On 27 Jan 2021, at 14:30, Bischoop wrote: > > > I don't have much experience with imaplib and for a few days can't > manage to get properly, I followed also some tutorial but also met few > problems. > What I want is to get email a

Re: _Py_FatalErrorFunc not found

2021-01-28 Thread Barry Scott
> On 28 Jan 2021, at 09:48, Klaus Dittrich wrote: > > > I need some help. > > hplip as of late complains : > > File "/usr/bin/hp-scan", line 40, in >import scanext > ImportError: /usr/lib/python3.9/site-packages/scanext.so: undefined symbol: > _Py_FatalErrorFunc > > Which module defi

Re: Best practice for handling exceptions raised at lower levels?

2021-02-02 Thread Barry Scott
> On 2 Feb 2021, at 00:54, Skip Montanaro wrote: > > I'm curious if there are best practices for handling exceptions raised > by lower level modules and packages. For example, I wrote an > application called polly[1] which constructs a personalized dictionary > from email messages using IMAP4.

Re: Best practice for handling exceptions raised at lower levels?

2021-02-02 Thread Barry Scott
> On 2 Feb 2021, at 20:24, Dan Stromberg wrote: > > > > On Tue, Feb 2, 2021 at 12:00 PM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > When I write packages I aim to trap the exceptions from the lower levels > and convert into a package specific exc

Re: Venv behaviour change py3.9

2021-02-14 Thread Barry Scott
> On 14 Feb 2021, at 09:42, Abdur-Rahmaan Janhangeer > wrote: > > Greetings all, > > on 3.7 when i do > > $ python -m venv venv > > it creates a venv in venv folder > > but on 3.9 it returns no such file or directory > > os: windows. Any ideas on why the behaviour changes? I did this on

Re: Why assert is not a function?

2021-03-03 Thread Barry Scott
> On 3 Mar 2021, at 17:35, David Lowry-Duda wrote: > >> assert condition, expression >> >> Only is condition is false with expression be evaluated. >> So you can safely do expensive things I the expression with incuring >> and cost if the condition is True. > > I think I've only every used

Re: Why assert is not a function?

2021-03-03 Thread Barry Scott
> On 3 Mar 2021, at 18:41, Chris Angelico wrote: > > On Thu, Mar 4, 2021 at 5:25 AM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: >> >> >> >>> On 3 Mar 2021, at 17:35, David Lowry-Duda wrote: >>> >>>> asser

Re: Determine what the calling program is

2021-04-19 Thread Barry Scott
> On 18 Apr 2021, at 14:46, Jason Friedman wrote: > > I should state at the start that I have a solution to my problem. I am > writing to see if there is a better solution. > > I have a program that runs via crontab every five minutes. It polls a > Box.com folder for files and, if any are fou

Re: "py.ini" question

2021-04-24 Thread Barry Scott
> On 24 Apr 2021, at 15:23, Gisle Vanem wrote: > > I have a question about the Python launcher; > c:\Windows\py.exe and the py.ini file. > > I have both Python 3.6 (32-bit) and Python 3.8 (64-bit) > installed. And I have a 'c:\Users\Gisle\AppData\Local\py.ini' > with this only: > [defaults]

Re: "py.ini" question

2021-04-26 Thread Barry Scott
> On 24 Apr 2021, at 20:56, Gisle Vanem wrote: > > On that, I'm getting: > Requested Python version (0) not installed > > Is that '-0' some 3.9+ feature? No its a lot older then 3.9 I cannot remember when -0 was first supported but I've been using -0 for a long long time. I using the explo

Re: "py.ini" question

2021-04-26 Thread Barry Scott
> On 26 Apr 2021, at 09:13, Gisle Vanem wrote: > > Thank for confirming what I suspected. And as I wrote earlier: > Since I'm on a 64-bit Python, a 'py -3' totally seems to ignore > 'py.ini', unless it says: >[defaults] >python3=3.6 >python3=3.6-32 You can prove that py.ini is i

Re: async watch directory for new files

2021-04-26 Thread Barry Scott
> On 24 Apr 2021, at 21:12, Zoran wrote: > > As I can see https://pypi.org/project/inotify/ > is not asyncio frendly. > Whatever I use, it should be asynchronous. > Final OS is linux (Centos 7), but I am doing development on Windows 10 > machine, so it wo

Re: Standarize TOML?

2021-05-17 Thread Barry Scott
> On 15 May 2021, at 23:39, Jason C. McDonald wrote: > > During the Steering Committee presentation at PyCon, it was mentioned > that no one has formally proposed TOML be added to the standard library > (emphasis on formal). THe joke went forth that there would be a flood > of proposals to tha

Re: f-strings and internationalisation.

2021-05-24 Thread Barry Scott
> On 24 May 2021, at 19:30, Antoon Pardon wrote: > > I have now come across several occasion where an author advice the use > of f-strings above the %-formatting and the format method. However it > seems these authors were only thinking about rather straight forward > english communication. >

Re: Definition of "property"

2021-05-30 Thread Barry Scott
> On 30 May 2021, at 17:57, Irv Kalb wrote: > > I am doing some writing (for an upcoming book on OOP), and I'm a little > stuck. > > I understand what a "property" is, how it is used and the benefits, but > apparently my explanation hasn't made the light bulb go on for my editor. > The

Re: 3.7.6 struggles a bit

2021-06-02 Thread Barry Scott
> On 2 Jun 2021, at 18:18, Luke wrote: > > When i wrote a program, i tried to open it but it struggles to open. I'm guessing you are a Windows user. Does this help? https://docs.python.org/3/faq/windows.html Barry -- https://mail.python.org/

Re: Interpreter Bug

2021-06-02 Thread Barry Scott
> On 2 Jun 2021, at 10:34, Alice Braim wrote: > > Good morning- > > > > I am having some very serious issues with Python, and I was hoping you > could help? > > I downloaded both Python and PyCharm, and the 2 do not seem to be working. > Every time I select Python as an interpret

Re: Optimizing Small Python Code

2021-06-24 Thread Barry Scott
> On 24 Jun 2021, at 16:58, Avi Gross via Python-list > wrote: > > Now a has a length of 53! > > It now looks like this: > > b'x\x9c3\xe4R\x00\x03\x03.#8\x0bB\x1br\x19c\x88(\x18q\x99p!q\xc1\x00\xa6\xd1\x98\xcb\x14S\x03\x9a\n\x13.3\x82j > \xb4\t\x94\x86\x99\t\x00\xdc\x87\x14\xb7' > > So th

Re: Cyclic imports

2021-08-17 Thread Barry Scott
On Monday, 16 August 2021 16:13:47 BST Dan Stromberg wrote: > Hi folks. > > I'm working on a large codebase that has at least one cyclic import. > > In case I end up needing to eliminate the cyclic imports, is there any sort > of tool that will generate an import graph and output Just the cycles?

Re: basic auth request

2021-08-17 Thread Barry Scott
On Tuesday, 17 August 2021 10:20:37 BST Robin Becker wrote: > While porting an ap from python2.7 to python3 I see this > > base64string = base64.b64encode('%s:%s' % (wsemail, wspassword)) > request.add_header("Authorization", "Basic %s" % base64string) > > in python3.x I find this wor

Re: basic auth request

2021-08-22 Thread Barry Scott
> On 22 Aug 2021, at 10:37, Chris Angelico wrote: > > When it comes to security, one thing I'm very curious about is why we > don't have any sort of certificate renewal verification. My browser > could retain the certificates of some web site (or of all web sites, > even - they're not THAT lar

Re: basic auth request

2021-08-25 Thread Barry Scott
> On 22 Aug 2021, at 12:03, Chris Angelico wrote: > > On Sun, Aug 22, 2021 at 8:30 PM Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: >> >> >> >> On 22 Aug 2021, at 10:37, Chris Angelico wrote: >> >> When it comes to security, on

Re: Definitive guide for Regex

2021-09-30 Thread Barry Scott
> On 30 Sep 2021, at 12:29, Shaozhong SHI wrote: > > Dear All, > > I am trying to look for a definitive guide for Regex in Python. > Can anyone help? Have you read the python docs for the re module? Barry > > Regards, > > David > -- > https://mail.python.org/mailman/listinfo/python-list

Re: Definitive guide for Regex

2021-09-30 Thread Barry Scott
> On 30 Sep 2021, at 19:35, dn via Python-list wrote: > > On 01/10/2021 06.16, Barry Scott wrote: >> >> >>> On 30 Sep 2021, at 12:29, Shaozhong SHI wrote: >>> >>> Dear All, >>> >>> I am trying to look for a definitive gu

Re: Definitive guide for Regex

2021-10-02 Thread Barry Scott
Barry > > Regards, > > David > > On Thu, 30 Sept 2021 at 22:02, Barry Scott <mailto:ba...@barrys-emacs.org>> wrote: > > > > On 30 Sep 2021, at 19:35, dn via Python-list > <mailto:python-list@python.org>> wrote: > > > > On 01/1

Re: Unable to compile my C Extension on Windows: unresolved external link errors

2021-11-13 Thread Barry Scott
> On 13 Nov 2021, at 09:00, Barry wrote: > > > >> On 12 Nov 2021, at 22:53, Marco Sulla wrote: >> >> It seems that on Windows it doesn't find python3.lib, >> even if I put it in the path. So I get the `unresolved external link` >> errors. > > I think you need the python310.lib (not sure o

Re: Unable to compile my C Extension on Windows: unresolved external link errors

2021-11-14 Thread Barry Scott
ange any conflicting symbols of course. Barry > > On Sat, 13 Nov 2021 at 12:17, Marco Sulla > wrote: >> >> . Sorry, the problem is I downloaded the 32 bit version of VS >> compiler and 64 bit version of Python.. >> >> On Sat, 13 Nov 2021 at

Re: Using astype(int) for strings with thousand separator

2021-11-14 Thread Barry Scott
> On 14 Nov 2021, at 15:41, Mahmood Naderan via Python-list > wrote: > > Hi > > While reading a csv file, some cells have values like '1,024' which I mean > they contains thousand separator ','. Therefore, when I want to process them > with > > row = df.iloc[0].astype(int) remove the

Re: Eventfd with epoll BlockingIOError

2021-11-25 Thread Barry Scott
> On 24 Nov 2021, at 22:42, Jen via Python-list wrote: > > I have a C program that uses fork-execv to run Python 3.10 in a child > process, and I am using eventfd with epoll for IPC between them. The eventfd > file descriptor is created in C and passed to Python through execv. Once the > P

Re: pyinstaller wrong classified as Windows virus

2021-11-25 Thread Barry Scott
> On 25 Nov 2021, at 09:20, Ulli Horlacher > wrote: > > When I compile my programs with pyinstaller, Windows classifies them as > virus and even deletes them! Microsoft will fix the malware detection if you provide the info they need. Submit false positive info to: https://www.microsoft.co

Re: Eventfd with epoll BlockingIOError

2021-11-27 Thread Barry Scott
> On 25 Nov 2021, at 22:29, jenk...@tutanota.com wrote: > > Thanks very much for your reply. > > I am now getting a single event returned in Python, but it's not the right > event, as I'll explain below. > > I rearranged the Python code based on your comments: > > #!/usr/bin/python3 > impo

Re: Python child process in while True loop blocks parent

2021-11-30 Thread Barry Scott
> On 29 Nov 2021, at 22:31, Jen Kris wrote: > > Thanks to you and Cameron for your replies. The C side has an epoll_ctl set, > but no event loop to handle it yet. I'm putting that in now with a pipe > write in Python-- as Cameron pointed out that is the likely source of > blocking on C. T

Re: Python child process in while True loop blocks parent

2021-12-04 Thread Barry Scott
> On 1 Dec 2021, at 16:01, Jen Kris wrote: > > Thanks for your comment re blocking. > > I removed pipes from the Python and C programs to see if it blocks without > them, and it does. > It looks now like the problem is not pipes. Ok. > I use fork() and execv() in C to run Python in a child

Re: Python child process in while True loop blocks parent

2021-12-06 Thread Barry Scott
> On 6 Dec 2021, at 17:09, Jen Kris via Python-list > wrote: > > I can't find any support for your comment that "Fork creates a new > process and therefore also a new thread." From the Linux man pages > https://www.man7.org/linux/man-pages/man2/fork.2.html, "The child process is > created w

Re: threading and multiprocessing deadlock

2021-12-06 Thread Barry Scott
> On 5 Dec 2021, at 23:50, Johannes Bauer wrote: > > Hi there, > > I'm a bit confused. In my scenario I a mixing threading with > multiprocessing. Threading by itself would be nice, but for GIL reasons > I need both, unfortunately. I've encountered a weird situation in which > multiprocessing

Re: Python child process in while True loop blocks parent

2021-12-06 Thread Barry Scott
> On 6 Dec 2021, at 21:05, Jen Kris wrote: > > Here is what I don't understand from what you said. "The child process is > created with a single thread—the one that called fork()." To me that implies > that the thread that called fork() is the same thread as the child process. > I guess y

Re: Python child process in while True loop blocks parent

2021-12-09 Thread Barry Scott
> On 8 Dec 2021, at 17:11, Jen Kris wrote: > > I started this post on November 29, and there have been helpful comments > since then from Barry Scott, Cameron Simpson, Peter Holzer and Chris > Angelico. Thanks to all of you. > > I've found a solution that works

Re: Py_TRASHCAN_SAFE_BEGIN/END in C extension?

2021-12-22 Thread Barry Scott
> On 22 Dec 2021, at 08:14, Marco Sulla wrote: > > Yes, it's deprecated, but I need it for Python 3.7, since there was > yet no Py_TRASHCAN_BEGIN / END Hopefully the bug report will makes clear what you have to do in your code to get things working. Barry > > On Tue, 21 Dec 2021 at 23:22,

Re: Selection sort

2021-12-24 Thread Barry Scott
> On 24 Dec 2021, at 14:22, vani arul wrote: > > Hello, > I am trying write a code.Can some help me find the error in my code. > Thanks! > > > def selectionsort(arr): > # le=len(arr) >for b in range(0,len(arr)-1): >pos=b >for a in range(b+1,len(arr)-1): >if

Re: What's the public API alternative to _PyObject_GC_IS_TRACKED()?

2021-12-26 Thread Barry Scott
> On 26 Dec 2021, at 13:48, Marco Sulla wrote: > > I have to use _PyObject_GC_IS_TRACKED(). It can't be used unless you > define Py_BUILD_CORE. I want to avoid this. What macro or function can > substitute it? Why is this needed by your code? Surely the GC does its thing as an implementation

Re: Uninstall old python version(Python 3.9.7)

2021-12-26 Thread Barry Scott
> On 25 Dec 2021, at 06:13, Công Huy wrote: > > I had uninstalled Python 3.9.7 before but it wasn't uninstalled > completely. I found it still in my computer and when I click "uninstall", > it sent me a board "No Python 3.9 installation was detected". Of course, > it won't be an issue i

Re: recover pickled data: pickle data was truncated

2021-12-26 Thread Barry Scott
> On 26 Dec 2021, at 13:44, Marco Sulla wrote: > > Use a semaphore. > > On Sun, 26 Dec 2021 at 03:30, iMath wrote: >> >> Normally, the shelve data should be read and write by only one process at a >> time, but unfortunately it was simultaneously read and write by two >> processes, thus co

Re: recover pickled data: pickle data was truncated

2022-01-02 Thread Barry Scott
> On 1 Jan 2022, at 16:13, Marco Sulla wrote: > > I agree with Barry. You can create a folder or a file with > pseudo-random names. I recommend you to use str(uuid.uuid4()) At work and personally I use iso-8601 timestamps to make the files unique and easy to find out when they where created.

Re: Who wrote Py_UNREACHABLE?

2022-01-02 Thread Barry Scott
> On 2 Jan 2022, at 16:17, Marco Sulla wrote: > > #if defined(RANDALL_WAS_HERE) > # define Py_UNREACHABLE() \ >Py_FatalError( \ >"If you're seeing this, the code is in what I thought was\n" \ >"an unreachable state.\n\n" \ >"I could give you advice for what to do,

Re: Why There Is No Python Compressed Archive or Binaries ?

2022-01-17 Thread Barry Scott
> On 17 Jan 2022, at 19:53, Sina Mobasheri wrote: > > Consider scenario that I want run python 3.10 in CentOS 8, I think last > python version in CentOS repository is 3.6, if I use epel I can get 3.8 so > ..., I think (correct me if I'm wrong 🙏🏻) the only way that I can run python > 3.10 is

Re: Puzzling behaviour of Py_IncRef

2022-01-19 Thread Barry Scott
> On 19 Jan 2022, at 10:57, Tony Flury via Python-list > wrote: > > I am writing a C extension module for an AVL tree, and I am trying to ensure > reference counting is done correctly. I was having a problem with the > reference counting so I worked up this little POC of the problem, and I

Re: How to test for maildir 'folder' in Python?

2022-01-23 Thread Barry Scott
> On 22 Jan 2022, at 21:26, Chris Green wrote: > > I have a script that walks a quite deep tree of mail messages to find > and archive old messages. I'm trying to convert it from mbox to > maildir (as I now store my mail in maildir format). > > So I need to test whether a point I have reached

Re: Puzzling behaviour of Py_IncRef

2022-01-27 Thread Barry Scott
> On 27 Jan 2022, at 07:46, Tony Flury wrote: > > > On 26/01/2022 22:41, Barry wrote: >> >> >> Run python and your code under a debugger and check the ref count of the >> object as you step through the code. >> >> Don’t just step through your code but also step through the C python code. >

Re: Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-02 Thread Barry Scott
> On 1 Feb 2022, at 23:40, Jen Kris wrote: > > Barry, thanks for your reply. > > On the theory that it is not yet possible to pass data from a non-Python > language to Python with multiprocessing.shared_memory, I bypassed the problem > by attaching 4 bytes to my FIFO pipe message from NASM

Re: venv and executing other python programs

2022-02-14 Thread Barry Scott
> On 15 Feb 2022, at 05:35, Mirko via Python-list > wrote: > > Hi, > > I have recently started using venv for my hobby-programming. There > is an annoying problem. Since venv modifies $PATH, python programs > that use the "#!/usr/bin/env python" variant of the hashbang often > fail since the

Re: venv and executing other python programs

2022-02-15 Thread Barry Scott
> On 15 Feb 2022, at 12:36, Martin Di Paola wrote: > > I did a few experiments in my machine. I created the following foo.py > > import pandas > print("foo") > > Now "pandas" is installed under Python 3 outside the venv. I can run it > successfully calling "python3 foo.py". > > If I add

Re: Best way to check if there is internet?

2022-02-25 Thread Barry Scott
> On 25 Feb 2022, at 18:07, Abdur-Rahmaan Janhangeer > wrote: > > Normally people put Python in the scripting category. > I learnt typed languages like C++ and Java at first. > People who learn languages like these tend to put > Python in a non-serious category. The post was > more ironic tha

Re: One-liner to merge lists?

2022-02-27 Thread Barry Scott
> On 22 Feb 2022, at 09:30, Chris Angelico wrote: > > On Tue, 22 Feb 2022 at 20:24, Frank Millman > wrote: >> >> Hi all >> >> I think this should be a simple one-liner, but I cannot figure it out. >> >> I have a dictionary with a number of keys, where each value

Re: ping script

2022-02-27 Thread Barry Scott
> On 27 Feb 2022, at 13:53, Byung-Hee HWANG wrote: > > simple ping check script with python3 (Python 3.9.2) > tested under Debian 11 Bullseye: > > soyeomul@penguin:~/gitlab/test$ ./fping.py localhost > ok > soyeomul@penguin:~/gitlab/test$ ./fping.py python.org > ok > soyeomul@penguin:~/gitlab

Re: Getting Syslog working on OSX Monterey

2022-02-28 Thread Barry Scott
> On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: > > On 2022-02-27 22:16:54 +, Barry wrote: >> If you look at the code of the logging modules syslog handle you will see >> that >> it does not use syslog. It’s assuming that it can network to a syslog >> listener. >> Such a listener is no

Re: Behavior of the for-else construct

2022-03-03 Thread Barry Scott
> On 3 Mar 2022, at 13:24, computermaster360 > wrote: > > I want to make a little survey here. > > Do you find the for-else construct useful? No. I always have to look up what condition the else fires on. > Have you used it in > practice? No. > Do you even know how it works, or that ther

Re: Getting Syslog working on OSX Monterey

2022-03-03 Thread Barry Scott
or years, been behaving as such when using > logging.handlers.SysLogHandler with a config in /etc/asl/ to define how it > should be routed and the rollover/cleanup frequency. > > Thanks for replying, just having trouble understanding. > > > On Mon, Feb 28, 2022 at 2:07

Re: Getting Syslog working on OSX Monterey

2022-03-05 Thread Barry Scott
> On 4 Mar 2022, at 21:23, Peter J. Holzer wrote: > > On 2022-02-28 22:05:05 +0000, Barry Scott wrote: >> On 28 Feb 2022, at 21:41, Peter J. Holzer wrote: >>> On 2022-02-27 22:16:54 +, Barry wrote: >>>> I have always assumed that if I want a logger sy

Re: virtualenv and make DESTDIR=

2022-03-05 Thread Barry Scott
> On 4 Mar 2022, at 13:03, Hartmut Goebel wrote: > > Hi, > > How can I make installing a virtual environment honor DESTDIR? How can I > install a virtual environment in $(DESTDIR)$(PREFIX), which behaves as being > set-up in $(PREFIX)? (Of course, this virtual environment can not be used. My

Re: virtualenv and make DESTDIR=

2022-03-05 Thread Barry Scott
> On 5 Mar 2022, at 16:59, Marco Sulla wrote: > > On Sat, 5 Mar 2022 at 17:36, Barry Scott wrote: >> Note: you usually cannot use pip when building an RPM with mock as the >> network is disabled inside the build for >> security reasons. > > Can't he pr

Re: virtualenv and make DESTDIR=

2022-03-05 Thread Barry Scott
> On 5 Mar 2022, at 19:56, Hartmut Goebel wrote: > > Am 05.03.22 um 17:34 schrieb Barry Scott: >> Have the RPM install all the pythone code and dependencies and also install >> a short script that >> sets up PYTHONPATH, LD_LIBRARY_PATH, etc and execs the python3 .py

Re: virtualenv and make DESTDIR=

2022-03-05 Thread Barry Scott
> On 5 Mar 2022, at 19:56, Hartmut Goebel wrote: > > Am 05.03.22 um 17:34 schrieb Barry Scott: >> Have the RPM install all the pythone code and dependencies and also install >> a short script that >> sets up PYTHONPATH, LD_LIBRARY_PATH, etc and execs the python3 .py

Re: virtualenv and make DESTDIR=

2022-03-06 Thread Barry Scott
> On 5 Mar 2022, at 19:56, Hartmut Goebel wrote: > > Am 05.03.22 um 17:34 schrieb Barry Scott: >> Have the RPM install all the pythone code and dependencies and also install >> a short script that >> sets up PYTHONPATH, LD_LIBRARY_PATH, etc and execs the pyt

Re: convenience

2022-03-23 Thread Barry Scott
> On 22 Mar 2022, at 18:00, Avi Gross via Python-list > wrote: > > An earlier post talked about a method they used for "convenience" in a way > they apparently did not understand and many of us educated them, hopefully. > > That made me wonder of teh impact on our code when we use various f

Django Application Model Reference

2016-11-02 Thread Dreyton Scott
Hello. I am currently creating a notification django application that will need to be able to "hook" into another django application. What my app needs is a way to retrieve all model classes in the connected application. Is there a way to do this? -- https://mail.python.org/mailman/listinfo/pyt

Re: Django Application Model Reference

2016-11-02 Thread Dreyton Scott
On Wednesday, November 2, 2016 at 1:40:35 PM UTC-4, Dreyton Scott wrote: > Hello. I am currently creating a notification django application that will > need to be able to "hook" into another django application. What my app needs > is a way to retrieve all model class

Re: Why exception from os.path.exists()?

2018-06-01 Thread Barry Scott
On Thursday, 31 May 2018 14:03:01 BST Marko Rauhamaa wrote: > Chris Angelico : > > On Thu, May 31, 2018 at 10:03 PM, Marko Rauhamaa wrote: > >> This surprising exception can even be a security issue: > >>>>> os.path.exists("\0") > >> > >>Traceback (most recent call last): > >> Fil

Re: Why exception from os.path.exists()?

2018-06-04 Thread Barry Scott
> On 1 Jun 2018, at 14:23, Paul Moore wrote: > > On 1 June 2018 at 13:15, Barry Scott wrote: >> I think the reason for the \0 check is that if the string is passed to the >> operating system with the \0 you can get surprising results. >> >> If \0 was not che

Re: Why exception from os.path.exists()?

2018-06-10 Thread Barry Scott
> On 10 Jun 2018, at 21:10, Chris Angelico wrote: > > On Mon, Jun 11, 2018 at 12:45 AM, Bev in TX wrote: >>> * One with an embedded / in the file name >> >> This is easily done in Finder, where I created a folder named "my/slash”. >> When I list it at the command line in Terminal, this shows u

Re: Why exception from os.path.exists()?

2018-06-11 Thread Barry Scott
> On 11 Jun 2018, at 01:28, Steven D'Aprano > wrote: > > On Sun, 10 Jun 2018 22:09:39 +0100, Barry Scott wrote: > >> Singling out os.path.exists as a special case I do think is reasonable. >> All functions that take paths need to have a consistent response

Re: Why exception from os.path.exists()?

2018-06-11 Thread Barry Scott
> On 11 Jun 2018, at 01:03, Chris Angelico wrote: > > On Mon, Jun 11, 2018 at 9:52 AM, Steven D'Aprano > wrote: >> On Mon, 11 Jun 2018 06:10:26 +1000, Chris Angelico wrote: >> >>> Can you try creating "spam:ham" and "spam/ham"? If they're both legal, >>> I'd like to see what their file names

Resources/pointers for writing maintable, testable Python

2016-05-18 Thread Jacob Scott
Many years ago, when I was primarily writing Java, I found Misko Hevery's Guide: Writing Testable Code to be incredibly helpful in guiding the design and structure of my codebase, and as reference for checking if my code was

Re: Resources/pointers for writing maintable, testable Python

2016-05-18 Thread Jacob Scott
) tend to be a bit lower level (utf-8 str) than what I'm focused on (maintainable and testable classes, functions, modules, etc). Thanks for the pointer to Code Like A Pythonista and the feedback on 2.7 vs 3! Jacob On Wed, May 18, 2016 at 5:55 PM, Ben Finney wrote: > Jacob Scott

Re: Resources/pointers for writing maintable, testable Python

2016-05-19 Thread Jacob Scott
Indeed, I skimmed the TOC for Test-Driven Development with Python and it does look to be rather Django-centric (which makes it a bit less helpful to me). I will take a look at "Testing Python: Applying Unit Testing, TDD, BDD and Acceptance Testing"! Thanks, Jacob On Thu, May 19, 2016 at 8:33 AM,

C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
When I use the C API to get the str() of an execption I see this text: But python reports the following for the same exception: TypeError: unsupported operand type(s) for +: 'int' and 'str' What do I need to do in the C API to get the the same text for the exception? All the c

C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
After calling PyObject_GetAttrString() I expected to get a PyObject string back but I found that I had been given a instead. (gdb) p *args_o $4 = What is going on and how do I get from the to the object I want? Barry -- https://mail.python.org/mailman/listinfo/python-list

Re: [solved] C API version of str(exception) is not the same as pure python version

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 11:59:16 GMT Barry Scott wrote: > When I use the C API to get the str() of an execption I see this text: > > > > But python reports the following for the same exception: > > TypeError: unsupported operand type(s) for +: 'int

Re: C API PyObject_GetAttrString returns not the object I expected

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 13:58:57 GMT Stefan Behnel wrote: > Barry Scott schrieb am 10.02.19 um 13:08: > > After calling PyObject_GetAttrString() I expected to get a PyObject string > > back but I found that I had been given a instead. > > > > (gdb) p *args_o >

Re: where is math_sin defined?

2019-02-10 Thread Barry Scott
On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: > As an aside, how is 'math.sin' actually implemented? mathmodule.c > refers to the function 'math_sin' but that name is not defined > anywhere in the Python source code. I'm a bit mystified as to how > CPython manages to compile! I used

Re: where is math_sin defined?

2019-02-11 Thread Barry Scott
> On 10 Feb 2019, at 16:43, Chris Angelico wrote: > > On Mon, Feb 11, 2019 at 3:37 AM Barry Scott wrote: >> >> On Sunday, 10 February 2019 15:15:32 GMT Jon Ribbens wrote: >>> As an aside, how is 'math.sin' actually implemented? mathmodule.c >&g

Re: What's up with Activestate Python?

2019-02-18 Thread Barry Scott
> On 18 Feb 2019, at 08:49, Thomas Jollans wrote: > > Anaconda also has its moments, and has some packages that PyPI doesn't > (for my use case, this is primarily PyQt5). Odd I use PyQt5 from PyPI all the time and have for a few years now. Barry -- https://mail.python.org/mailman/listinfo/

Connector/Python, MySQL Workbench Issue

2019-02-25 Thread Scott Sorgent
Connector/Python 3.7 then downloaded and tried installing, but immediately, I get a popup saying Python v3.7 not installed. Why is this happening and what should I do to get everything installed and working? Thanks, Scott -- https://mail.python.org/mailman/listinfo/python-list

Re: User failed to install PIP

2019-06-24 Thread Barry Scott
I guess you attached an image of the error message. I also going to guess that you are a windows user. All attachments are stripped on this list. You will need to explain in text what you did and what the error message was. Note that PIP is install when you install python. Have you installed pyt

<    1   2   3   4   5   6   7   8   9   10   >