Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-14 Thread Loris Bennett via Python-list
Left Right writes: >> I am not entirely convinced by NB2. I am, in fact, a sort of sysadmin >> person and most of my programs write to a log file. The programs are >> also moderately complex, so a single program might access a database, >> query an LDAP server, send email etc., so potentially q

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-12 Thread Loris Bennett via Python-list
to stderr? Quite apart from that, I find having a log file a useful for debugging when I am developing. Cheers, Loris > On Mon, Nov 11, 2024 at 4:00 PM Loris Bennett via Python-list > wrote: >> >> Hi, >> >> I have the following in my program: >>

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-12 Thread Loris Bennett via Python-list
Chris Angelico writes: > On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list > wrote: >> 2. In terms of generating a helpful error message, how should one >>distinguish between the config file not existing and the log file not >>existing? > >

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-12 Thread Loris Bennett via Python-list
Cameron Simpson writes: > On 11Nov2024 18:24, dieter.mau...@online.de wrote: >>Loris Bennett wrote at 2024-11-11 15:05 +0100: >>>I have the following in my program: >>>try: >>>logging.config.fileConfig(args.config_file) >>&

Re: FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-12 Thread Loris Bennett via Python-list
Chris Angelico writes: > On Tue, 12 Nov 2024 at 01:59, Loris Bennett via Python-list > wrote: >> 2. In terms of generating a helpful error message, how should one >>distinguish between the config file not existing and the log file not >>existing? > >

Re: Seeking Assistance with Python's IDLE for Blind Users

2024-11-11 Thread Loris Bennett via Python-list
Dear Jeff, writes: > Dear Python Users Group, > > > > I am currently learning Python. I am blind and use the JAWS screen reader to > assist me. I am trying to use Python's IDLE editor but find it quite > challenging. When I move my cursor to a line of code, it reads out the > letters or words

FileNotFoundError thrown due to file name in file, rather than file itself

2024-11-11 Thread Loris Bennett via Python-list
Hi, I have the following in my program: try: logging.config.fileConfig(args.config_file) config = configparser.ConfigParser() config.read(args.config_file) if args.verbose: print(f"Configuration file: {args.config_file}") except FileNotFoundErro

Re: Specifying local dependency with Poetry

2024-11-06 Thread Loris Bennett via Python-list
Greg Ewing writes: > On 6/11/24 4:13 am, Loris Bennett wrote: >> [tool.poetry.dependencies] >> python = "^3.6" >> first-package = "^1.6.0" >>Could not find a version that satisfies the requirement >> first-package<2.0.0,>=1.6.0 (from

Specifying local dependency with Poetry

2024-11-05 Thread Loris Bennett via Python-list
Hi, I have installed a package, 'first-package, built using Poetry and installed it as root in /usr/local. The package is on sys.path so root can successfully import it. I have now developed a second package which depends on 'first-package'. I would have expected that I could specify this depend

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > "Loris Bennett" writes: > >> Cameron Simpson writes: >> >>> On 01Nov2024 10:10, Loris Bennett wrote: >>>>as expected. The non-UTF-8 text occurs when I do >>>> >>>> mail = EmailMes

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > Cameron Simpson writes: > >> On 01Nov2024 10:10, Loris Bennett wrote: >>>as expected. The non-UTF-8 text occurs when I do >>> >>> mail = EmailMessage() >>> mail.set_content(body, cte="quoted-pri

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
Inada Naoki writes: > 2024年11月2日(土) 0:36 Loris Bennett via Python-list : > >> Left Right writes: >> >> > There's quite a lot of misuse of terminology around terminal / console >> > / shell. Please, correct me if I'm wrong, but it looks like you ar

Re: Printing UTF-8 mail to terminal

2024-11-04 Thread Loris Bennett via Python-list
Cameron Simpson writes: > On 01Nov2024 10:10, Loris Bennett wrote: >>as expected. The non-UTF-8 text occurs when I do >> >> mail = EmailMessage() >> mail.set_content(body, cte="quoted-printable") >> ... >> >> if args.verbose: &g

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
Cameron Simpson writes: > On 31Oct2024 16:33, Loris Bennett wrote: >>I have a command-line program which creates an email containing German >>umlauts. On receiving the mail, my mail client displays the subject and >>body correctly: > [...] >>So far, so good. How

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
splayed. I'm not using MS Windows. I am using a Gnome terminal on Debian 12 locally and connecting via SSH to a AlmaLinux 8 server, where I start a tmux session. > On Thu, Oct 31, 2024 at 5:19 PM Loris Bennett via Python-list > wrote: >> >> Hi, >> >> I have a command-l

Re: Printing UTF-8 mail to terminal

2024-11-01 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > Cameron Simpson writes: > >> On 31Oct2024 16:33, Loris Bennett wrote: >>>I have a command-line program which creates an email containing German >>>umlauts. On receiving the mail, my mail client displays the subject and >&g

Printing UTF-8 mail to terminal

2024-10-31 Thread Loris Bennett via Python-list
Hi, I have a command-line program which creates an email containing German umlauts. On receiving the mail, my mail client displays the subject and body correctly: Subject: Übung Sehr geehrter Herr Dr. Bennett, Dies ist eine Übung. So far, so good. However, when I use the --verbose opti

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-31 Thread Loris Bennett via Python-list
Jon Ribbens writes: > On 2024-10-30, Loris Bennett wrote: >> Jon Ribbens writes: >>> On 2024-10-30, Loris Bennett wrote: >>>> Jon Ribbens writes: >>>>> As per the docs you link to, the read() method only takes filename(s) >>>>> as

Poetry: endpoints with endpoints

2024-10-31 Thread Loris Bennett via Python-list
Hi, I am using Poetry and have the following in my pyproj.toml [tool.poetry.scripts] frobnicate = "frobnicator.cli:frobnicate" The CLI provides an option '--flavour' and I would like to add further endpoints for specific values of 'flavour'. I tried adding frobnicate_foo = "frobnicator.

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Loris Bennett via Python-list
Jon Ribbens writes: > On 2024-10-30, Loris Bennett wrote: >> Jon Ribbens writes: >>> As per the docs you link to, the read() method only takes filename(s) >>> as arguments, if you have an already-open file you want to read then >>> you should use the read

Re: Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-30 Thread Loris Bennett via Python-list
Jon Ribbens writes: > On 2024-10-29, Loris Bennett wrote: >> Hi, >> >> With Python 3.9.18, if I do >> >> try: >> with open(args.config_file, 'r') as config_file: >> config = configparser.ConfigParser() >&

Using 'with open(...) as ...' together with configparser.ConfigParser.read

2024-10-29 Thread Loris Bennett via Python-list
Hi, With Python 3.9.18, if I do try: with open(args.config_file, 'r') as config_file: config = configparser.ConfigParser() config.read(config_file) print(config.sections()) i.e try to read the configuration with the variable defined via 'with ... a

Common objects for CLI commands with Typer

2024-09-20 Thread Loris Bennett via Python-list
Hi, Apologies if the following description is to brief - I can expand if no one knows what I'm on about, but maybe a short description is enough. I am developing a command line application using Typer. Most commands need to do something in a database and also do LDAP stuff. Currently each comma

Re: Python Dialogs

2024-05-03 Thread Loris Bennett via Python-list
r...@zedat.fu-berlin.de (Stefan Ram) writes: > Me (indented by 2) and the chatbot (flush left). Lines lengths > 72! Is there a name for this kind of indentation, i.e. the stuff you are writing not being flush left? It is sort of contrary to what I think of as "normal" indentation. You seem to

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Loris Bennett via Python-list
"Michael F. Stemper" writes: > On 25/03/2024 01.56, Loris Bennett wrote: >> Grant Edwards writes: >> >>> On 2024-03-22, Loris Bennett via Python-list wrote: >>> >>>> Yes, I was mistakenly thinking that the popping the element would >

Re: Popping key causes dict derived from object to revert to object

2024-03-25 Thread Loris Bennett via Python-list
Grant Edwards writes: > On 2024-03-22, Loris Bennett via Python-list wrote: > >> Yes, I was mistakenly thinking that the popping the element would >> leave me with the dict minus the popped key-value pair. > > It does. Indeed, but I was thinking in the context of

Re: Popping key causes dict derived from object to revert to object

2024-03-24 Thread Loris Bennett via Python-list
writes: > Loris wrote: > > "Yes, I was mistakenly thinking that the popping the element would leave > me with the dict minus the popped key-value pair. Seem like there is no > such function." > > Others have tried to explain and pointed out you can del and then use the > changed dict. > > But co

Re: Popping key causes dict derived from object to revert to object

2024-03-22 Thread Loris Bennett via Python-list
Mark Bourne writes: > Loris Bennett wrote: >> Hi, >> I am using SQLAlchemy to extract some rows from a table of 'events'. >> From the call to the DB I get a list of objects of the type >>sqlalchemy.orm.state.InstanceState >> I would like to

Popping key causes dict derived from object to revert to object

2024-03-21 Thread Loris Bennett via Python-list
Hi, I am using SQLAlchemy to extract some rows from a table of 'events'. >From the call to the DB I get a list of objects of the type sqlalchemy.orm.state.InstanceState I would like to print these rows to the terminal using the 'tabulate' package, the documentation for which says The module

Re: Configuring an object via a dictionary

2024-03-18 Thread Loris Bennett via Python-list
Tobiah writes: > I should mention that I wanted to answer your question, > but I wouldn't actually do this. I'd rather opt for > your self.config = config solution. The config options > should have their own namespace. > > I don't mind at all referencing foo.config['option'], > or you could mak

Configuring an object via a dictionary

2024-03-15 Thread Loris Bennett via Python-list
Hi, I am initialising an object via the following: def __init__(self, config): self.connection = None self.source_name = config['source_name'] self.server_host = config['server_host'] self.server_port = config['server_port'] self.user_base = config['u

Accessing configuration across multiple modules

2023-11-28 Thread Loris Bennett via Python-list
Hi, I am using Typer to create a command-line program with multiple levels of subcommands, so a typical call might look like mytool --config-file=~/test/mytool.conf serviceXYZ list people In the top-level mytool.main, I evaluate the option '--config-file' and read the config file to initialize

Re: Printing dict value for possibly undefined key

2023-11-28 Thread Loris Bennett via Python-list
DL Neil writes: > On 11/25/2023 3:31 AM, Loris Bennett via Python-list wrote: >> Hi, >> I want to print some records from a database table where one of the >> fields contains a JSON string which is read into a dict. I am doing >> something like >>

Re: Printing dict value for possibly undefined key

2023-11-28 Thread Loris Bennett via Python-list
duncan smith writes: > On 24/11/2023 16:35, duncan smith wrote: >> On 24/11/2023 14:31, Loris Bennett wrote: >>> Hi, >>> >>> I want to print some records from a database table where one of the >>> fields contains a JSON string which is rea

Printing dict value for possibly undefined key

2023-11-25 Thread Loris Bennett via Python-list
Hi, I want to print some records from a database table where one of the fields contains a JSON string which is read into a dict. I am doing something like print(f"{id} {d['foo']} {d['bar']}") However, the dict does not always have the same keys, so d['foo'] or d['bar'] may be undefined. I ca

Re: SQL rollback of multiple inserts involving constraints

2023-11-13 Thread Loris Bennett via Python-list
n-a-flush-and-commit-baec6c2410a9 > > > HTH Yes, thank you, it does. I hadn't been aware of 'flush'. > Jacob Kruger > +2782 413 4791 > "Resistance is futile!...Acceptance is versatile..." > > > On 2023/11/10 11:15, Loris Bennett via Python-list wrot

SQL rollback of multiple inserts involving constraints

2023-11-10 Thread Loris Bennett via Python-list
Hi, In my MariaDB database I have a table 'people' with 'uid' as the primary key and a table 'groups' with 'gid' as the primary key. I have a third table 'memberships' with 'uid' and 'gid' being the primary key and the constraint that values for 'uid' and 'gid' exist in the tables 'people' and 'g

Re: NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > "Loris Bennett" writes: > >> Hi, >> >> I have two applications. One uses the system version of Python, which >> is 3.6.8, whereas the other uses Python 3.10.8 installed in a non-system >> path. For both appl

Re: NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
"Loris Bennett" writes: > Hi, > > I have two applications. One uses the system version of Python, which > is 3.6.8, whereas the other uses Python 3.10.8 installed in a non-system > path. For both applications I am using poetry with a pyproject.toml > file which cont

NameError: name '__version__' is not defined

2023-10-27 Thread Loris Bennett via Python-list
Hi, I have two applications. One uses the system version of Python, which is 3.6.8, whereas the other uses Python 3.10.8 installed in a non-system path. For both applications I am using poetry with a pyproject.toml file which contains the version information and __init__.py at the root which con

Installing package as root to a system directory

2023-09-28 Thread Loris Bennett via Python-list
Hi, I use poetry to develop system software packages as a normal user. To install the packages I use, again as a normal user export PYTHONUSERBASE=/some/path pip3 install --user somepackage.whl and add /some/path to /usr/lib64/python3.6/site-packages/zedat.pth This works well enough,

Displaying CPU instruction sets used for TensorFlow build?

2023-09-05 Thread Loris Bennett via Python-list
Hi, Does anyone know how I can display the CPU instruction sets which were used when TensorFlow was compiled? I initially compiled TF on a machine with a CPU which supports AVX512_VNNI. I subsequently recompiled on a second machine without AVX512_VNNI, but when I run a test program on the second

Initialising a Config class

2023-04-11 Thread Loris Bennett
Hi, Having solved my problem regarding setting up 'logger' such that it is accessible throughout my program (thanks to the help on this list), I now have problem related to a slightly similar issue. My reading suggests that setting up a module with a Config class which can be imported by any part

Re: When is logging.getLogger(__name__) needed?

2023-04-05 Thread Loris Bennett
"Loris Bennett" writes: > dn writes: > >> On 01/04/2023 02.01, Loris Bennett wrote: >>> Hi, >>> In my top level program file, main.py, I have >>>def main_function(): >>>parser = argparse.ArgumentParser(description=&qu

Re: When is logging.getLogger(__name__) needed?

2023-04-05 Thread Loris Bennett
dn writes: > On 01/04/2023 02.01, Loris Bennett wrote: >> Hi, >> In my top level program file, main.py, I have >>def main_function(): >>parser = argparse.ArgumentParser(description="my prog") >>... >>

Re: When is logging.getLogger(__name__) needed?

2023-04-04 Thread Loris Bennett
Peter Otten <__pete...@web.de> writes: > On 31/03/2023 15:01, Loris Bennett wrote: [snip (53 lines)] > Your problem has nothing to do with logging -- it's about visibility > ("scope") of names: > >>>> def use_name(): > print(name) &

When is logging.getLogger(__name__) needed?

2023-03-31 Thread Loris Bennett
Hi, In my top level program file, main.py, I have def main_function(): parser = argparse.ArgumentParser(description="my prog") ... args = parser.parse_args() config = configparser.ConfigParser() if args.config_file is None: config_file = DEFAULT_CONFI

Re: Python file location

2023-03-30 Thread Loris Bennett
windhorn writes: > I have an older laptop I use for programming, particularly Python and > Octave, running a variety of Debian Linux, and I am curious if there > is a "standard" place in the file system to store this type of program > file. OK, I know they should go in a repository and be managed

Re: Standard class for time *period*?

2023-03-29 Thread Loris Bennett
Cameron Simpson writes: > On 28Mar2023 08:05, Dennis Lee Bieber wrote: >> So far, you seem to be the only person who has ever asked for >> asingle >>entity incorporating an EPOCH (datetime.datetime) + a DURATION >>(datetime.timedelta). > > But not the only person to want one. I've got a

Re: Standard class for time *period*?

2023-03-28 Thread Loris Bennett
Thomas Passin writes: > On 3/27/2023 11:34 AM, rbowman wrote: >> On Mon, 27 Mar 2023 15:00:52 +0200, Loris Bennett wrote: >> >>>I need to deal with what I call a 'period', which is a span of time >>>limited by two dates, start and end. The p

Re: Standard class for time *period*?

2023-03-28 Thread Loris Bennett
Dennis Lee Bieber writes: > On Tue, 28 Mar 2023 08:14:55 +0200, "Loris Bennett" > declaimed the following: > >> >>No, it doesn't. I already know about timedelta. I must have explained >>the issue badly, because everyone seems to be fixating on the &

Re: Standard class for time *period*?

2023-03-27 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > r...@zedat.fu-berlin.de (Stefan Ram) writes: >>d = datetime_diff.days >>h, rem = divmod( datetime_diff.seconds, 3600 ) >>m, s = divmod( rem, 60 ) >>print( f'{d:02}-{h:02}:{m:02}:{s:02}' ) > > If the default formatting is acceptable to you, you can a

Standard class for time *period*?

2023-03-27 Thread Loris Bennett
Hi, I have been around long enough to know that, due to time-zones, daylight saving and whatnot, time-related stuff is complicated. So even if I think something connected with time should exist, there may well be a very good reason why it does not. My problem: I need to deal with what I call

Re: Implementing a plug-in mechanism

2023-03-16 Thread Loris Bennett
Simon Ward writes: > On Thu, Mar 16, 2023 at 07:45:18AM +1300, dn via Python-list wrote: >> There is a PyPi library called pluggy (not used it). I've used >> informal approaches using an ABC as a framework/reminder (see >> @George's response). > > typing.Protocol is also useful here as the plugin

Implementing a plug-in mechanism

2023-03-15 Thread Loris Bennett
Hi, I have written a program which, as part of the non-core functionality, contains a module to generate email. This is currently very specific to my organisation, so the main program contains import myorg.mailer This module is specific to my organisation in that it can ask an internal serv

Re: Distributing program for Linux

2023-03-15 Thread Loris Bennett
Anssi Saari writes: > "Loris Bennett" writes: > >> I am aware that an individual user could use (mini)conda to install a >> more recent version of Python in his/her home directory, but I am >> interested in how root would install such a program. > > Ro

Re: Distributing program for Linux

2023-03-15 Thread Loris Bennett
versions to do the right thing. Cheers, Loris > From: Python-list > on behalf of Loris Bennett > Date: Tuesday, March 14, 2023 at 12:27 PM > To: python-list@python.org > Subject: Distributing program for Linux > *** Attention: This is an external email. Use caution responding,

Distributing program for Linux

2023-03-14 Thread Loris Bennett
Hi, If I write a system program which has Python >= 3.y as a dependency, what are the options for someone whose Linux distribution provides Python 3.x, where x < y? I am aware that an individual user could use (mini)conda to install a more recent version of Python in his/her home directory, but I

Re: putting JUNK at the end of a [.py] file

2023-02-24 Thread Loris Bennett
Hen Hanna writes: > in a LaTeX file, after the (1st) \end{document} line, > i can put any random Junk i want(afterwards) until the end of the > file. > > > Is there a similar Method for a.py file ? > > Since i know of no such trick, i sometimes put this (be

Re: argparse — adding a --version flag in the face of positional args

2022-11-28 Thread Loris Bennett
Mats Wichmann writes: > On 11/27/22 16:40, Skip Montanaro wrote: >> I have a script to which I'd like to add a --version flag. It should print >> the version number then exit, much in the same way --help prints the help >> text then exits. I haven't been able to figure that out. I always get a >>

Re: Preprocessing not quite fixed-width file before parsing

2022-11-25 Thread Loris Bennett
Thomas Passin writes: > On 11/24/2022 9:06 AM, Loris Bennett wrote: >> Thomas Passin writes: >> >>> On 11/23/2022 11:00 AM, Loris Bennett wrote: >>>> Hi, >>>> I am using pandas to parse a file with the following structure: >>>> Nam

Re: Preprocessing not quite fixed-width file before parsing

2022-11-24 Thread Loris Bennett
Thomas Passin writes: > On 11/23/2022 11:00 AM, Loris Bennett wrote: >> Hi, >> I am using pandas to parse a file with the following structure: >> Name filesettype KB quota limit >> in_doubtgrace |files quotalimit in_

Preprocessing not quite fixed-width file before parsing

2022-11-23 Thread Loris Bennett
Hi, I am using pandas to parse a file with the following structure: Name filesettype KB quota limit in_doubt grace |files quotalimit in_doubtgrace shortname sharedhome USR14097664 524288000 545259520 0 none | 107110

Re: Gdal

2022-10-07 Thread Loris Bennett
Hi Conrado, "\"Jorge Conrado Conforte\"" writes: > Hi, > > > > > I installed GDAL using the pip command and conda. But, I did: > > import gdal and I had: Depending on your GDAL version, you might find you have to do from osgeo import gdal See https://gdal.org/api/python_bindings.html#

poetry: local dependencies in dev and prod environments

2022-09-13 Thread Loris Bennett
Hi, Say I have two modules: main application and a utility. With poetry I can add the utility as local dependency to the main application thus: poetry add ../utilities/mailer/dist/my_mailer-0.1.0-py3-none-any.whl This then generates the following in the pyproj.toml of the main application:

Re: Exclude 'None' from list comprehension of dicts

2022-08-05 Thread Loris Bennett
Antoon Pardon writes: > Op 4/08/2022 om 13:51 schreef Loris Bennett: >> Hi, >> >> I am constructing a list of dictionaries via the following list >> comprehension: >> >>data = [get_job_efficiency_dict(job_id) for job_id in job_ids] >> >&g

Exclude 'None' from list comprehension of dicts

2022-08-04 Thread Loris Bennett
Hi, I am constructing a list of dictionaries via the following list comprehension: data = [get_job_efficiency_dict(job_id) for job_id in job_ids] However, get_job_efficiency_dict(job_id) uses 'subprocess.Popen' to run an external program and this can fail. In this case, the dict should jus

Re: Exclude 'None' from list comprehension of dicts

2022-08-04 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>data = [get_job_efficiency_dict(job_id) for job_id in job_ids] > ... >>filtered_data = list(filter(None, data)) > > You could have "get_job_efficiency_dict" return an iterable

2 options both mutually exclusive with respect to 3rd option

2022-08-03 Thread Loris Bennett
Hi, I want to plot some data which are collected over time. I either want to specify start and/or end times for the plot, or specify last week, month or year. So the usage would look like: plot_data [[--start START --end END] | --last LAST ] I know about argsparse's mutually exclusive group,

Re: poetry script fails to find module

2022-07-29 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>However, in the development environment, if I run >> python stoat/main.py hpc user --help >>then is >> stoat/hpc/main.py >>being found via >> import hpc.main >>becau

Re: poetry script fails to find module

2022-07-29 Thread Loris Bennett
Hi Stefan, r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>Why is the module 'hpc' not found by the poetry script? > > I have tried to execute the following sequence of shell > commands to understand your problem. Here they

Re: poetry script fails to find module

2022-07-29 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>However, this raises the question of why it worked in the first place >>in the poetry shell. > > It might have had a different or extended sys.path. In the poetry shell sys.path has this

Re: poetry script fails to find module

2022-07-28 Thread Loris Bennett
"Loris Bennett" writes: > Hi, > > The following is a little bit involved, but I hope can make the problem clear. > > Using poetry I have written a dummy application which just uses to typer > to illustrate a possible interface design. The directory structure is a

poetry script fails to find module

2022-07-28 Thread Loris Bennett
Hi, The following is a little bit involved, but I hope can make the problem clear. Using poetry I have written a dummy application which just uses to typer to illustrate a possible interface design. The directory structure is a follows: $ tree -P *.py . |-- dist |-- stoat | |-- hpc

Re: Python & nmap

2022-05-20 Thread Loris Bennett
Lars Liedtke writes: > Ansible has got a shell module, so you could run custom commands on all > hosts. But it gets more difficult in parsing the output afterwards. If you just want to copy files, pdsh[1] or clush[2] might be enough. Cheers, Loris Footnotes: [1] https://github.com/chaos/pdsh

Re: Request for assistance (hopefully not OT)

2022-05-18 Thread Loris Bennett
Chris Angelico writes: > On Wed, 18 May 2022 at 04:05, Loris Bennett > wrote: >> >> [snip (26 lines)] >> >> > I think you had a problem before that. Debian testing is not an >> > operating system you should be using if you have a fairly good >

Re: Request for assistance (hopefully not OT)

2022-05-17 Thread Loris Bennett
o1bigtenor writes: > Greetings > > I was having space issues in my /usr directory so I deleted some > programs thinking that the space taken was more an issue than having > older versions of the program. > > So one of the programs I deleted (using rm -r) was python3.9. Deleting anything from /us

Re: Request for assistance (hopefully not OT)

2022-05-17 Thread Loris Bennett
[snip (26 lines)] > I think you had a problem before that. Debian testing is not an > operating system you should be using if you have a fairly good > understanding of how Debian (or Linux in general) works. Should be I think you had a problem before that. Debian testing is not an operatin

Re: Instatiating module / Reusing module of command-line tool

2022-05-06 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>My question: What is the analogue to initialising an object via the >>constructor for a module? > > If you need a class, you can write a class. > > When one imports a modu

Re: Match.groupdict: Meaning of default argument?

2022-05-03 Thread Loris Bennett
Julio Di Egidio writes: > On Friday, 29 April 2022 at 09:50:08 UTC+2, Loris Bennett wrote: >> Hi, >> >> If I do >> >> import re >> pattern = >> re.compile(r'(?P\d*)(-?)(?P\d\d):(?P\d\d):(?P\d\d)') >> s = '104-02:47:06&

Re: Match.groupdict: Meaning of default argument?

2022-05-03 Thread Loris Bennett
"Loris Bennett" writes: > r...@zedat.fu-berlin.de (Stefan Ram) writes: > >> "Loris Bennett" writes: >>>I thought that 'days' would default to '0'. >> >> It will get the value '0' if (?P\d*) does >>

Re: Match.groupdict: Meaning of default argument?

2022-05-03 Thread Loris Bennett
r...@zedat.fu-berlin.de (Stefan Ram) writes: > "Loris Bennett" writes: >>I thought that 'days' would default to '0'. > > It will get the value '0' if (?P\d*) does > /not/ participate in the match. > > In your case, it /d

Match.groupdict: Meaning of default argument?

2022-04-29 Thread Loris Bennett
Hi, If I do import re pattern = re.compile(r'(?P\d*)(-?)(?P\d\d):(?P\d\d):(?P\d\d)') s = '104-02:47:06' match = pattern.search(s) match_dict = match.groupdict('0') I get match_dict {'days': '104', 'hours': '02', 'minutes': '47', 'seconds': '06'} However, if the string has no in

Instatiating module / Reusing module of command-line tool

2022-04-29 Thread Loris Bennett
Hi, I have a command-line script in Python to get the correct salutation for a user name in either English or German from a 'salutation server': $ get_salutation alice Dear Professor Müller $ get_salutation alice -l de Sehr geehrte Frau Professorin Müller The hostname, port, user and pas

Re: matplotlib: scatterplot and histogram with same colour scale

2022-04-26 Thread Loris Bennett
"Loris Bennett" writes: > Hi, > > I am using matplotlib to create scatterplot where the colour depends on > the y-value. Additionally I want to project the y-values onto a rotated > histogram along the right side of the scatterplot. > > My problem is that with my

matplotlib: scatterplot and histogram with same colour scale

2022-04-26 Thread Loris Bennett
Hi, I am using matplotlib to create scatterplot where the colour depends on the y-value. Additionally I want to project the y-values onto a rotated histogram along the right side of the scatterplot. My problem is that with my current code, the colours used for the histogram are normalised to th

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

2022-04-20 Thread Loris Bennett
Dennis Lee Bieber writes: > On Tue, 19 Apr 2022 15:51:09 +0200, "Loris Bennett" > declaimed the following: > >>If I am merely trying to represent part a very large number of seconds >>as a number of years, 365 days per year does not seem that controversial >

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

2022-04-20 Thread Loris Bennett
Random832 writes: > On Tue, Apr 19, 2022, at 07:11, Loris Bennett wrote: >> I now realise that timedelta is not really what I need. I am >> interested solely in pure periods, i.e. numbers of seconds, that I >> can convert back and forth from a format such as > > A t

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

2022-04-19 Thread Loris Bennett
Jon Ribbens writes: > On 2022-04-19, Loris Bennett wrote: >> If I am merely trying to represent part a very large number of seconds >> as a number of years, 365 days per year does not seem that controversial >> to me. Obviously there are issues if you expect all periods of

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

2022-04-19 Thread Loris Bennett
Jon Ribbens writes: > On 2022-04-19, Loris Bennett wrote: >> I now realise that timedelta is not really what I need. I am interested >> solely in pure periods, i.e. numbers of seconds, > > That's exactly what timedelta is. > >> that I can convert back and for

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

2022-04-19 Thread Loris Bennett
Jon Ribbens writes: > On 2022-04-19, Loris Bennett wrote: >> Jon Ribbens writes: >>> On 2022-04-19, Loris Bennett wrote: >>>> I now realise that timedelta is not really what I need. I am interested >>>> solely in pure periods, i.e. numbers of seconds

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

2022-04-19 Thread Loris Bennett
"Peter J. Holzer" writes: > On 2022-04-16 20:35:22 -, Jon Ribbens via Python-list wrote: >> On 2022-04-16, Peter J. Holzer wrote: >> > On 2022-04-16 14:22:04 -, Jon Ribbens via Python-list wrote: >> >> ... although now having looked into the new 'zoneinfo' module slightly, >> >> it reall

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

2022-04-14 Thread Loris Bennett
"Loris Bennett" writes: > Hi, > > With Python 3.9.2 I get > > $ import datetime > $ s = "1-00:01:01" > $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") > $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, > se

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

2022-04-14 Thread Loris Bennett
Hi, With Python 3.9.2 I get $ import datetime $ s = "1-00:01:01" $ t = datetime.datetime.strptime(s, "%d-%H:%M:%S") $ d = datetime.timedelta(days=t.day, hours=t.hour, minutes=t.minute, seconds=t.second) $ d.days 1 $ d.seconds 61 $ d.minutes AttributeError: 'datetime.timedelta

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-14 Thread Loris Bennett
Marco Sulla writes: > On Fri, 11 Mar 2022 at 19:10, Michael Torrie wrote: >> Both Debian stable and Ubuntu LTS state they have a five year support >> life cycle. > > Yes, but it seems that official security support in Debian ends after > three years: > > "Debian LTS is not handled by the Debian

Re: How to test input via subprocess.Popen with data from file

2022-03-10 Thread Loris Bennett
Dieter Maurer writes: > Loris Bennett wrote at 2022-3-10 13:16 +0100: >>I have a command which produces output like the >>following: >> >> Job ID: 9431211 >> Cluster: curta >> User/Group: build/staff >> State: COMPLETED (exit code 0) >> Nod

Re: Suggestion for Linux Distro (from PSA: Linux vulnerability)

2022-03-10 Thread Loris Bennett
Marco Sulla writes: > On Thu, 10 Mar 2022 at 04:50, Michael Torrie wrote: >> >> On 3/9/22 13:05, Marco Sulla wrote: >> > So my laziness pays. I use only LTS distros, and I update only when >> > there are security updates. >> > PS: any suggestions for a new LTS distro? My Lubuntu is reaching its

How to test input via subprocess.Popen with data from file

2022-03-10 Thread Loris Bennett
Hi, I have a command which produces output like the following: Job ID: 9431211 Cluster: curta User/Group: build/staff State: COMPLETED (exit code 0) Nodes: 1 Cores per node: 8 CPU Utilized: 01:30:53 CPU Efficiency: 83.63% of 01:48:40 core-walltime Job Wall-clock time: 00:13:35

Re: SQLAlchemy: JSON vs. PickleType vs. raw string for serialised data

2022-03-02 Thread Loris Bennett
Dennis Lee Bieber writes: > On Tue, 01 Mar 2022 08:35:05 +0100, Loris Bennett > declaimed the following: > >>Thanks for the various suggestions. The data I need to store is just a >>dict with maybe 3 or 4 keys and short string values probably of less >>than 32 char

Re: SQLAlchemy: JSON vs. PickleType vs. raw string for serialised data

2022-03-01 Thread Loris Bennett
Robert Latest writes: > Loris Bennett wrote: >> Thanks for the various suggestions. The data I need to store is just a >> dict with maybe 3 or 4 keys and short string values probably of less >> than 32 characters each per event. The traffic on the DB is going to be >&g

  1   2   >