Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 18:34:39 -0800, Grant Edwards wrote: > On 2022-03-06, Avi Gross via Python-list wrote: > > Python is named after a snake right? > > No. It's named after a comedy troupe. He actually wrote that two sentences later. hp -- _ | Peter J. Holzer| Story must make more s

Re: Behavior of the for-else construct

2022-03-06 Thread Grant Edwards
On 2022-03-06, Avi Gross via Python-list wrote: > Python is named after a snake right? No. It's named after a comedy troupe. -- Grant -- https://mail.python.org/mailman/listinfo/python-list

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Yeup, that would be my first choice but the catch is that "sayhi" may not be a function of the given module. It could be a static method of some class or any other callable. Ah, fair. Are you able to define it by a "path", where each step in the path is a getattr() call? Yes but I think th

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
I'm not so sure about that. The author of the plugin knows they're writing code that will be dynamically loaded, and can therefore expect the kind of problem they're having. It could be argued that it's their responsibility to ensure that all the needed code is loaded into the subprocess. Ye

Re: C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-06 Thread MRAB
On 2022-03-07 00:32, Jen Kris via Python-list wrote: I am using the C API in Python 3.8 with the nltk library, and I have a problem with the return from a library call implemented with PyObject_CallFunctionObjArgs. This is the relevant Python code: import nltk from nltk.corpus import gutenber

C API PyObject_CallFunctionObjArgs returns incorrect result

2022-03-06 Thread Jen Kris via Python-list
I am using the C API in Python 3.8 with the nltk library, and I have a problem with the return from a library call implemented with PyObject_CallFunctionObjArgs.  This is the relevant Python code: import nltk from nltk.corpus import gutenberg fileids = gutenberg.fileids() sentences = gutenberg

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Greg Ewing
On 7/03/22 9:36 am, Martin Di Paola wrote: It *would* be my fault if multiprocessing.Process fails only because I'm loading the code dynamically. I'm not so sure about that. The author of the plugin knows they're writing code that will be dynamically loaded, and can therefore expect the kind of

Re: Behavior of the for-else construct

2022-03-06 Thread Dennis Lee Bieber
On Sun, 6 Mar 2022 17:39:51 +0100, "Peter J. Holzer" declaimed the following: > >(* *) for comments was actually pretty commonly used - maybe because it >stands out more than { }. I don't know if I've ever seen (. .) instead >of [ ]. > Or some terminals provided [ ] but not { }

Re: mac app from a python script?

2022-03-06 Thread Dan Stromberg
On Sun, Jan 23, 2022 at 9:59 AM Dan Stromberg wrote: > > Hi folks. > > I have a Python 3 script (built on top of gi.respository.Gtk) that runs on > Linux and macOS 11.5. It's at > https://stromberg.dnsalias.org/~strombrg/hcm/ if you're curious. > > It works the way I want on Linux, but on macOS

Re: Behavior of the for-else construct

2022-03-06 Thread Chris Angelico
On Mon, 7 Mar 2022 at 09:51, Avi Gross via Python-list wrote: > > >>> > Pascal versus PASCAL versus pascal (not versus paschal) and > Perl versus PERL versus perl (not versus pearl) > > seems to be a topic. > <<< > > The nitpickers here are irrelevant. I happen to know how things are formally > s

Re: Behavior of the for-else construct

2022-03-06 Thread Avi Gross via Python-list
>>> Pascal versus PASCAL versus pascal (not versus paschal) and Perl versus PERL versus perl (not versus pearl) seems to be a topic. <<< The nitpickers here are irrelevant. I happen to know how things are formally spelled and if I was publishing a book, might carefully proofread it. I sometimes

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Barry
> On 6 Mar 2022, at 19:38, Peter J. Holzer wrote: > > On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote: >>> On 2022-03-05 16:25:38 +, Barry Scott wrote: >>> Using the syslog() function means that any platform/distro details are >>> hidden from the user of syslog() and as is the case of

Re: virtualenv and make DESTDIR=

2022-03-06 Thread Barry
> On 6 Mar 2022, at 16:53, Peter J. Holzer wrote: > > On 2022-03-05 17:59:48 +0100, 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 reas

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Chris Angelico
On Mon, 7 Mar 2022 at 07:37, Martin Di Paola wrote: > > > > > > >The way you've described it, it's a hack. Allow me to slightly redescribe it. > > > >modules = loader() > >objs = init(modules) > > > >def invoke(mod, func): > ># I'm assuming that the loader is smart enough to not load > >#

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Try to use `fork` as "start method" (instead of "spawn"). Yes but no. Indeed with `fork` there is no need to pickle anything. In particular the child process will be a copy of the parent so it will have all the modules loaded, including the dynamic ones. Perfect. The problem is that `fork` is t

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
The way you've described it, it's a hack. Allow me to slightly redescribe it. modules = loader() objs = init(modules) def invoke(mod, func): # I'm assuming that the loader is smart enough to not load # a module that's already loaded. Alternatively, load just the # module you need,

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 18:28:59 +0100, Peter J. Holzer wrote: > On 2022-03-05 16:25:38 +, Barry Scott wrote: > > Using the syslog() function means that any platform/distro details are > > hidden from the user of syslog() and as is the case of macOS it > > "just works". > > That doesn't seem to be case.

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Dieter Maurer
Martin Di Paola wrote at 2022-3-6 12:42 +: >Hi everyone. I implemented time ago a small plugin engine to load code >dynamically. > >So far it worked well but a few days ago an user told me that he wasn't >able to run in parallel a piece of code in MacOS. > >He was using multiprocessing.Process

Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
On 2022-03-06 09:29:19 -0800, Grant Edwards wrote: > On 2022-03-05, Avi Gross via Python-list wrote: > > I am not sure how we end up conversing about PASCAL on a Python > > forum. > > [...] > > I paid no attention to where PASCAL was being used other than I did > > much of my grad school work in P

Re: Behavior of the for-else construct

2022-03-06 Thread Grant Edwards
On 2022-03-05, Avi Gross via Python-list wrote: > I am not sure how we end up conversing about PASCAL on a Python > forum. > [...] > I paid no attention to where PASCAL was being used other than I did > much of my grad school work in PASCAL [...] It's "Pascal". It's not an acronym. It's a guy's

Re: Getting Syslog working on OSX Monterey

2022-03-06 Thread Peter J. Holzer
On 2022-03-05 16:25:38 +, Barry Scott wrote: > On 4 Mar 2022, at 21:23, Peter J. Holzer wrote: > > If you are saying that SysLogHandler should use a system specific > > default (e.g. "/dev/log" on Linux) instead of UDP port 514 everywhere, I > > agree 99 % (the remaining 1 % is my contrarian a

Re: Timezone for datetime.date objects

2022-03-06 Thread Morten W. Petersen
On Wed, Mar 2, 2022 at 6:20 PM Peter J. Holzer wrote: > On 2022-02-28 23:28:23 +0100, Morten W. Petersen wrote: > > Well, let's say I specify the datetime 2022-02-22 02:02 (AM). I think > > everyone could agree that it also means 2022-02-22 02:02:00:00, to > > 2022-02-22 02:02:59:59. > > I disagr

Re: virtualenv and make DESTDIR=

2022-03-06 Thread Peter J. Holzer
On 2022-03-05 17:59:48 +0100, 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 previously download the packages and run p

Re: Behavior of the for-else construct

2022-03-06 Thread Peter J. Holzer
On 2022-03-05 14:25:35 -0500, Dennis Lee Bieber wrote: > On Sat, 5 Mar 2022 12:39:36 -0600, "Michael F. Stemper" > declaimed the following: > >... especially Pascal, which was probably bigger in Germany and Austria > >in the 1980s than was C. > > Pascal also defined alternate representation

Re: Cpython: when to incref before insertdict

2022-03-06 Thread Marco Sulla
On Sun, 6 Mar 2022 at 03:20, Inada Naoki wrote: > In general, when reference is borrowed from a caller, the reference is > available during the API. > But merge_dict borrows reference of key/value from other dict, not caller. > [...] > Again, insertdict takes the reference. So _PyDict_FromKeys() *

Issues of pip install gdal and fiona

2022-03-06 Thread Shaozhong SHI
I downloaded .whl files for fiona and gdal to go with Python3.6.5. However, I am having trouble with red error messages. Though Gdal is now working, there is a warning message - Missing global ~ gdal: DRIVER_NAME declaration gdal_array,py Can anyone advise on how to resolve the issues? Regard

Re: Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Chris Angelico
On Sun, 6 Mar 2022 at 23:43, Martin Di Paola wrote: > > Hi everyone. I implemented time ago a small plugin engine to load code > dynamically. > > So far it worked well but a few days ago an user told me that he wasn't > able to run in parallel a piece of code in MacOS. > > He was using multiproces

Execute in a multiprocessing child dynamic code loaded by the parent process

2022-03-06 Thread Martin Di Paola
Hi everyone. I implemented time ago a small plugin engine to load code dynamically. So far it worked well but a few days ago an user told me that he wasn't able to run in parallel a piece of code in MacOS. He was using multiprocessing.Process to run the code and in MacOS, the default start metho

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 python3 .py. > The scripts are already