Re: Best (simplest) way to share data between processes

2024-07-07 Thread Barry via Python-list



> On 7 Jul 2024, at 22:13, Chris Green via Python-list  
> wrote:
> 
> a simple file lock can then
> be used to prevent simultaneous access (well, simultaneous access when
> the writing process is writing).

There is a simple pattern to make this robust.

Write new values to a tmp file.
Close the tmp file.
Then use os.rename(tmpfile, productionfile).

This is guaranteed that any process that reads the file will only see all the 
old file contents or all the new file contents,  never a mix of both.

Barry


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


Re: Terminal Emulator (Posting On Python-List Prohibited)

2024-05-19 Thread Barry via Python-list


> On 18 May 2024, at 16:27, Peter J. Holzer via Python-list 
>  wrote:
> 
> I don't think Linux users have to deal with venvs

Modern debian (ubuntu) and fedora block users installing using pip.
You must use a venv to pip install packages from pypi now.
This is implemented in python and pip and enabled by the distros.

There are ways to turn off the blocking, but it’s strongly discouraged
by the distros.

Barry



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


Re: Issues with uninstalling python versions on windows server

2024-05-03 Thread Barry via Python-list


> On 3 May 2024, at 17:43, Tripura Seersha via Python-list 
>  wrote:
> 
> Hi Team,
> 
> I am working on an automation related to uninstalling and installing python 
> versions on different windows servers.
> 
> I have observed that uninstallation is working only with the account/login 
> using which the python version is installed. But for automation, we are not 
> aware which account is being used for installation on different machines.

I would guess that this is because you installed for the user not for all-users.
If true fix your install to do it for all-users and you should be able to 
uninstall as any user.

But this will require admin privs for both install and uninstall. As assume you 
can find out how to bet the admin priv required for your automation.

Barry

> 
> Also, with the approach of using msiexec.exe to uninstall different 
> components of python version, though all the components are uninstalled 
> successfully but still an entry for this version shows in the control panel 
> with the options: Modify, repair and uninstall. I am unable to identify which 
> component has still remained as a part of the installer.
> 
> Could you please help me resolve these issues.
> 
> Thanks,
> Tripura
> --
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: Making 'compiled' modules work with multiple python versions on Linux

2024-04-02 Thread Barry via Python-list


> On 1 Apr 2024, at 18:14, Left Right via Python-list  
> wrote:
> 
> It sounds weird that symbols from Limited API are _missing_ (I'd
> expect them to be there no matter what library version you link with).

You have to specify the version of the limited API that you want to use.
Each release adds more symbols to the limited API.
So if you compile against 3.10 version it works with 3.10, 3.11, 3.12 etc,
but not with 3.9.

My pycxx project has test code that I use to verify pycxx’s use of python API.
You could check out the source and run my tests to see how things work.
It is on https://sourceforge.net/projects/cxx/

Barry


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


Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-04-02 Thread Barry via Python-list


> On 1 Apr 2024, at 15:52, Jacob Kruger via Python-list 
>  wrote:
> 
> Found many, many mentions of errors, with some of the same keywords, but, no 
> resolutions that match my exact issue at all.

Try asking the pyinstaller developers. I think there is a mailing list.

Barry
> 
> 
> As in, most of them are mentioning older versions of python, and, mainly 
> different platforms - mac and linux, but, various google searches have not 
> mentioned much of using it on windows, and having it just stop working.
> 
> 
> Now did even try shifting over to python 3.12, but, still no-go.
> 
> 
> If launch pyinstaller under python 3.10 on this exact same machine, 
> pyinstaller runs - just keep that older version hovering around for a couple 
> of occasional tests, partly since some of my target environments are still 
> running older versions of python, but anyway.
> 
> 
> Also, not really relevant, but, cx_freeze is perfectly able to generate 
> executables for this same code, but, then not combining all output into a 
> single file - will stick to that for now, but, not always as convenient, and, 
> still wondering what changed here.
> 
> 
> Jacob Kruger
> +2782 413 4791
> "Resistance is futile!...Acceptance is versatile..."
> 
> 
>> On 2024/03/31 14:51, Barry wrote:
>> 
 On 31 Mar 2024, at 13:24, Jacob Kruger via Python-list 
  wrote:
>>> 
>>> pkg_resources.DistributionNotFound: The 'altgraph' distribution was not 
>>> found and is required by the application
>> I think I have seen this error being discussed before…
>> 
>> A web search for pyinstaller and that error leads to people discussing why 
>> it happens it looks like.
>> 
>> Barry
>> 
>> 
> --
> https://mail.python.org/mailman/listinfo/python-list

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


Re: Trying to use pyinstaller under python 3.11, and, recently started receiving error message about specific module/distribution

2024-03-31 Thread Barry via Python-list


> On 31 Mar 2024, at 13:24, Jacob Kruger via Python-list 
>  wrote:
> 
> pkg_resources.DistributionNotFound: The 'altgraph' distribution was not found 
> and is required by the application

I think I have seen this error being discussed before…

A web search for pyinstaller and that error leads to people discussing why it 
happens it looks like.

Barry


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


Re: Making 'compiled' modules work with multiple python versions on Linux

2024-03-29 Thread Barry via Python-list



> On 28 Mar 2024, at 16:13, Olivier B. via Python-list  
> wrote:
> 
> But on Linux, it seems that linking to libpython3.so instead of
> libpython3.11.so.1.0 does not have the same effect, and results in
> many unresolved python symbols at link time
> 
> Is this functionality only available on Windows?

Python limited API works on linux, but you do not link against the .so on linux 
I recall.

You will have missed that libpython3.so is a symlink to libpython3.11.so.10.

Windows build practices do not translate one-to-one to linux, or macOS.

Barry


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


Re: ANN: EmPy 4.1 -- a powerful, robust and mature templating system for Python

2024-03-25 Thread Barry via Python-list
You should considered also announcing on https://discuss.python.org/ which is a 
lot more active then this list.

Barry


> On 25 Mar 2024, at 04:13, Erik Max Francis via Python-list 
>  wrote:
> 
> I'm pleased to announce the release of EmPy 4.1.
> 
> The 4._x_ series is a modernization of the software and a revamp of
> the EmPy system to update its feature set and make it more consistent
> with the latest Python versions and practices.  EmPy 4._x_ was also
> relicensed to BSD.
> 
> The 4._x_ series adds new markups, including inline comments,
> backquote literals, chained if-then-else extended expression,
> functional expressions, support for modern Pythonic controls,
> stringized and multiline significators, named escapes, diacritics,
> icons, and emojis.
> 
> It adds support for configuration objects (replacing options
> dictionaries); native support for Unicode, file buffering, reference
> counted `sys.stdout` proxies and error dispatchers and handlers; fixes
> several serious bugs; has a set of full unit and system tests, an
> extensive builtin help system; and the online documention has been
> rewritten and expanded.
> 
> Attempts have been made to make EmPy 4._x_ as backward compatible as
> is practical.  Most common markup has not changed; the only changes
> being removal of `repr` (in favor of backquote literals) as well as
> literal close parenthesis, bracket and brace markup; in-place markup
> has changed syntax (to make way for emojis); and custom markup is now
> parsed more sensibly.
> 
> Most backward-incompatible changes are in the embedding interface.
> The `Interpreter` constructor and global `expand` function now require
> keyword arguments to prevent further backward compatibility problems,
> though effort has been made to make the behavior as backward
> compatible as possible.  The supported environment variables have
> changed, as well as the filter, diversion and hook APIs, and options
> dictionaries no longer exist (in deference to configurations).
> 
> For a comprehensive list of changes from 3._x_ to 4._x_, see:
> 
> 
> 
> ## Introduction:  Welcome to EmPy!
> 
> [EmPy](http://www.alcyone.com/software/empy/) is a powerful, robust and mature
> templating system for inserting Python code in template text.  EmPy
> takes a source document, processes it, and produces output.  This is
> accomplished via expansions, which are signals to the EmPy system
> where to act and are indicated with markup.  Markup is set off by a
> customizable prefix (by default the at sign, `@`).  EmPy can expand
> arbitrary Python expressions, statements and control structures in
> this way, as well as a variety of additional special forms.  The
> remaining textual data is sent to the output, allowing Python to be
> used in effect as a markup language.
> 
> EmPy also supports hooks, which can intercept and modify the behavior
> of a running interpreter; diversions, which allow recording and
> playback; filters, which are dynamic and can be chained together; and
> a dedicated user-customizable callback markup.  The system is highly
> configurable via command line options, configuration files, and
> environment variables.  An extensive API is also available for
> embedding EmPy functionality in your own Python programs.
> 
> EmPy also has a supplemental library for additional non-essential
> features (`emlib`), a documentation building library used to create
> this documentation (`emdoc`), and an extensive help system (`emhelp`)
> which can be queried from the command line with the main executable
> `em.py` (`-h/--help`, `-H/--topics=TOPICS`).  The base EmPy
> interpreter can function with only the `em.py`/`em` file/module
> available.
> 
> EmPy can be used in a variety of roles, including as a templating
> system, a text processing system (preprocessing and/or
> postprocessing), a simple macro processor, a frontend for a content
> management system, annotating documents, for literate programming, as
> a souped-up text encoding converter, a text beautifier (with macros
> and filters), and many other purposes.
> 
> 
> ### Markup overview
> 
> Expressions are embedded in text with the `@(...)` notation;
> variations include conditional expressions with `@(...?...!...)`  and
> the ability to handle thrown exceptions with `@(...$...)`.  As a
> shortcut, simple variables and expressions can be abbreviated as
> `@variable`, `@object.attribute`, `@sequence[index]`,
> `@function(arguments...)`, `@function{markup}{...}` and
> combinations.  Full-fledged statements are embedded with `@{...}`.
> Control flow in terms of conditional or repeated expansion is
> available with `@[...]`.  A `@` followed by any whitespace character
> (including a newline) expands to nothing, allowing string
> concatenations and line continuations.  Line comments are indicated
> with `@#...` including the trailing newline.  `@*...*` allows inline
> comments.  Escapes are indicated with 

Re: the name ``wheel''

2024-03-24 Thread Barry via Python-list


> On 22 Mar 2024, at 20:28, Mats Wichmann via Python-list 
>  wrote:
> 
> pip is still a separate package in the .rpm world. which makes sense on a 
> couple of levels:

Yes it’s a separate package, but it’s always installed. At least on Fedora.
I agree it makes sense to package it separately, which is inline with Fedora’s
policy of not vendoring code into a package.

Barry


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


Re: the name ``wheel''

2024-03-22 Thread Barry via Python-list


> On 22 Mar 2024, at 15:25, Gilmeh Serda via Python-list 
>  wrote:
> 
>> Many if not most Linux distributions do not include pip by default.
> 
> Really? It came with Manjaro.

Debian and Ubuntu require you to install pip as a separate package.
Also puts venv in its own package.

Fedora leaves all the batteries intact and rhel I assume.

Barry





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


Re: Configuring an object via a dictionary

2024-03-16 Thread Barry via Python-list


> On 15 Mar 2024, at 19:51, Thomas Passin via Python-list 
>  wrote:
> 
> I've always like writing using the "or" form and have never gotten bit

I, on the other hand, had to fix a production problem that using “or” 
introducted.
I avoid this idiom because it fails on falsy values.

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


Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Barry via Python-list


> On 10 Mar 2024, at 14:49, Thomas Passin via Python-list 
>  wrote:
> 
> That and there's a registry setting:
> 
> https://learn.microsoft.com/en-us/windows/win32/fileio/maximum-file-path-limitation
> 
Yep that and rules about size of parts of the path.

Barry


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


Re: pathlib.Path.is_file vs os.path.isfile difference

2024-03-10 Thread Barry via Python-list



> On 8 Mar 2024, at 23:19, Thomas Passin via Python-list 
>  wrote:
> 
> We just learned a few posts back that it might be specific to Linux; I ran it 
> on Windows.

Depending on the exact win32 api used there is a 257 limit on windows.
The 257 includes 2 for the device, C:, and 255 for the path part that will use 
1 for the leading \. Getting an error for a name that is 255 is not surprising.

Other api allow for 65535 limit, not sure on its additional limits.

Barry


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


Re: Problem resizing a window and button placement

2024-02-24 Thread Barry via Python-list



> On 24 Feb 2024, at 04:36, Steve GS via Python-list  
> wrote:
> 
> How do I extract the values
> from args?

You can look up the args in documentation.
You can run the example code MRAB provided and see what is printed to learn 
what is in the args.

Barry


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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2024-01-16 Thread Barry via Python-list


> On 16 Jan 2024, at 17:11, Sibylle Koczian via Python-list 
>  wrote:
> 
> while the new Windows 11 machine finds the Microsoft stub

You can turn off the stub in windows settings. The magic windows jargon is
“App Execution Aliases”. Once you find it in settings you can turn off
the python and python3 aliases.

Barry




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


Re: Question about garbage collection

2024-01-16 Thread Barry via Python-list



> On 16 Jan 2024, at 12:10, Frank Millman via Python-list 
>  wrote:
> 
> My problem is that my app is quite complex, and it is easy to leave a 
> reference dangling somewhere which prevents an object from being gc'd.

What I do to track these problems down is use gc.get_objects() then summerize 
the number of each type. Part 2 is to print the delta after an interval of a 
2nd summary.
Leaks of objects show up as the count of a type increasing every time you 
sample.


Barry


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


Re: Question about garbage collection

2024-01-16 Thread Barry via Python-list



> On 16 Jan 2024, at 13:17, Thomas Passin via Python-list 
>  wrote:
> 
> The usual advice is to call deleteLater() on objects derived from PyQt 
> classes.  I don't know enough about PyQt to know if this takes care of all 
> dangling reference problems, though.

It works well and robustly.

Barry


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


Re: Question about garbage collection

2024-01-16 Thread Barry via Python-list



> On 16 Jan 2024, at 03:49, Thomas Passin via Python-list 
>  wrote:
> 
> This kind of thing can happen with PyQt, also.  There are ways to minimize it 
> but I don't know if you can ever be sure all Qt C++ objects will get deleted. 
> It depends on the type of object and the circumstances.

When this has been seen in the past it has been promptly fixed by the 
maintainer.

Barry




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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2024-01-01 Thread Barry via Python-list



> On 1 Jan 2024, at 11:14, Sibylle Koczian via Python-list 
>  wrote:
> 
> But in all this thread I didn't see a single explanation for my current 
> situation: one and the same shebang line works on Windows 10 / Python 3.11 
> and doesn't work on Windows 11 / Python 3.12. I suspect Windows, because a 
> change in the way Python 3.12 uses shebang lines should be visible in the 
> documentation.

See my earlier reply with info on ftype etc output.
What do you see on your windows 10 vs windows 11?

Barry


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


Re: mypy question

2023-12-30 Thread Barry via Python-list



> On 30 Dec 2023, at 15:11, Karsten Hilbert via Python-list 
>  wrote:
> 
> queries = [{'SQL': 'SELECT %(value)s', 'args': {'value': 1}}]
> 
> and
> 
> run_queries(conn, queries:list[str|dict[str, Any]]):

In cases like this I often use a wrapper class in place of a simple str.
If you have a class SqlString then your type becomes list[SqlString].

You may find that SqlString gains interesting methods over time.

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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-24 Thread Barry via Python-list



> On 24 Dec 2023, at 00:54, rbowman via Python-list  
> wrote:
> 
> Does that work with virtualenv or conda? I'm slowly getting up to speed
> with those.

Conda is its own thing, not need for py.exe.

Once you have created the venv you do not need py.exe as you will have 
pythob.exe in the venv bin folder.

Barry



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


Re: What is Install-Paths-To in WHEEL file?

2023-12-24 Thread Barry via Python-list



> On 24 Dec 2023, at 00:58, Left Right via Python-list  
> wrote:
> 
> I'm trying to understand the contents of Wheel files

There are lots of packaging experts that hang out on 
https://discuss.python.org/ you are likely to get a response there if not here 
replies.

Barry

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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Barry via Python-list



> On 23 Dec 2023, at 00:15, Thomas Passin via Python-list 
>  wrote:
> 
> In neither case is the shebang line used.

As i understand it, not in front of my windows box to check.
The handler for .py file extension is set to be the py.exe
It is py.exe that understands shebang lines.

Barry


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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Barry via Python-list



> On 22 Dec 2023, at 14:58, Christian Buhtz via Python-list 
>  wrote:
> 
> On Windows 11 it usually is the "Terminal" which is different from cmd.exe.

In terminal app you can run cmd.exe or powershell, so it is basically the same.

Barry


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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Barry via Python-list



> On 22 Dec 2023, at 14:29, Sibylle Koczian  wrote:
> 
> #!/usr/bin/env/python

That was what i thought you had and it will not work.

The BOM suggestion is worth trying.

Barry


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


Re: Python 3.12.1, Windows 11: shebang line #!/usr/bin/env python3 doesn't work any more

2023-12-22 Thread Barry via Python-list


> On 22 Dec 2023, at 12:39, Sibylle Koczian via Python-list 
>  wrote:
> 
> Hello,
> 
> I always install Python on Windows in the same manner:
> 
> - Python is not on the path,
> - it is installed for all users,
> - the Python Launcher is installed for all users,
> - the file types .py, .pyw etc. are associated with Python.
> 
> My shebang line is usually "#!/usr/bin/env python3".
> 
> This has always worked well. I could run Python scripts in a console
> window entering just the script name, by double clicking in the explorer
> or using WIN+r; the two last variants for GUI or for scripts with
> something like "input('Leave with Enter')" at the end.
> 
> Now I've got a new computer with Windows 11 and I've installed Python
> 3.12.1. On my older machine it's Windows 10 and Python 3.11.5. Reading
> the Python documentation it seems my shebang lines should work as before
> - but they don't. The error message:
> 
> "Unable to create process using 'C:\usr\bin\env\python
> "C:\Eigen\Src\launcher_versuche.py" ': Das System kann die angegebene
> Datei nicht finden."
> 
> Without the "env" in the shebang line and only without it everything
> works as expected - but that's contrary to the documentation, isn't it?

This suggests a typo in the shebang line. Is there a space between env and 
python?

Barry


> 
> Thank you for information,
> Sibylle
> --
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: xor operator

2023-11-13 Thread Barry via Python-list



> On 13 Nov 2023, at 17:48, Dom Grigonis  wrote:
> 
> Short circuiting happens, when:
> xor([True, True, False, False], n=1)
> At index 1 it is clear that the answer is false.

Can you share an example with 4 values that is true?
And explain why it is xor.

Barry

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


Re: No current way to just compile flet code into truly native packages for smart phones, etc.?

2023-11-13 Thread Barry via Python-list


> On 13 Nov 2023, at 17:21, Jacob Kruger via Python-list 
>  wrote:
> 
> Had a look at the following bit of introduction to using python and flet to 
> build cross-platform flutter-based apps using same python code, and, while it 
> seems to work alright if tell it to run as under GUI here on windows desktop, 
> and, while can get it to fire up PWA version as well, that's not really 
> stand-alone since will still require code to be running in background, and, 
> in terms of, for example, android, it seems like it will need to then be 
> running via the native android flet interpreter for it to work as such?
> 
> 
> https://flet.dev/docs/
> 
> 
> Flet PWA deployment 
> 

flet looks interesting. It seems from the road map there is lots missing today.
Also the people that know flet are on discord. You may find someone here.

Barry

> 
> --
> 
> Jacob Kruger
> +2782 413 4791
> "Resistance is futile!...Acceptance is versatile..."
> 
> --
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: xor operator

2023-11-13 Thread Barry via Python-list



> On 13 Nov 2023, at 15:16, Dom Grigonis via Python-list 
>  wrote:
> 
> I think it could be useful to have `xor` builtin, which has API similar to 
> the one of `any` and `all`.

I do not understand how xor(iterator) works.
I thought xor takes exactly 2 args.

I also do not understand how xor can be short circuited.
For AND or OR only looking at the first arg works.
But that does not work for xor right?

Barry


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


Re: Question(s)

2023-10-24 Thread Barry via Python-list



> On 24 Oct 2023, at 18:25, o1bigtenor via Python-list  
> wrote:
> 
> Is there a way to verify that a program is going to do what it is
> supposed to do

In the general case not proven to be not possible.
Have a read about the halting problem 
https://en.wikipedia.org/wiki/Halting_problem

It is common to simulate hardware that does not exist yet and run software in 
the simulated environment.

Barry

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


Re: How to write list of integers to file with struct.pack_into?

2023-10-02 Thread Barry via Python-list
 On 2 Oct 2023, at 16:02, Jen Kris via Python-list
  wrote:

 Iwant to write a list of 64-bit integers to a binary file.  Everyexample
 I have seen in my research convertsit to .txt, but I want it in binary.
  I wrote this code,based on some earlier work I have done:
 buf= bytes((len(qs_array)) * 8)

   buf is not writable so cannot be used by pack_into. I think you need to
   use bytesarray not bytes.

 foroffset in range(len(qs_array)):
 item_to_write= bytes(qs_array[offset])
 struct.pack_into(buf,"https://mail.python.org/mailman/listinfo/python-list

References

   Visible links
   1. Permalink to this definition
https://docs.python.org/3/library/struct.html#struct.pack_into
-- 
https://mail.python.org/mailman/listinfo/python-list


Re: type annotation vs working code

2023-10-01 Thread Barry via Python-list



> On 1 Oct 2023, at 19:36, Richard Damon via Python-list 
>  wrote:
> 
> Perhaps a better method would be rather than just using the name and catching 
> the exception, use a real already_initialized flag (set to True when you 
> initialize), and look it up with getattr() with a default value of False.
I would use a class variable not an instance variable.

class OnlyOne:
   sole_instance = None
   def __init__(self):
  assert OnlyOne.sole_instance is None
  OnlyOne.sole_instance = self

Barry


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


Re: venv --upgrade 3.12.0rc2 --> 3.12.0rc3 failure

2023-09-28 Thread Barry via Python-list



> On 27 Sep 2023, at 12:50, Robin Becker via Python-list 
>  wrote:
> 
> Attempting venv upgrade  3.12.0rc2 --> 3.12.0rc3 I find pyvenv.cfg changes, 
> but the virtual python doesn't.
> I guess this ought to be a bug.

You must delete and then recreate the venv if the version of python changes.
It is not a bug in python.

Barry


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


Re: `time.perf_counter_ns` always a 64-bit int?

2023-09-16 Thread Barry via Python-list


> On 15 Sep 2023, at 23:00, rmlibre--- via Python-list  
> wrote:
> 
> I'd like to capture the output of `time.perf_counter_ns()` as an 8-byte
> timestamp.
> 
> I'm aware that the docs provide an undefined start value for that clock.
> I'm going to assume that means it can't be expected to fit within 8
> bytes. However, it would be rather convenient if it could. Does anyone
> know if any such platform agnostic assumption could be made for any
> fixed number of bytes, even if it isn't exactly 8 bytes?

If you read the source code the value is stored in a 64 bit int for unix and 
windows.

There is a comment that it covers the range of +-232 years.

Barry

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

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


Re: Finding good documentation for gpiod

2023-09-03 Thread Barry via Python-list
E

> On 3 Sep 2023, at 22:49, Chris Green via Python-list  
> wrote:
> 
> Mostly I am managing to get things to work as I want but better
> documentation of gpiod would be a great help.

Ask the author? https://github.com/aswild/python-gpiod

Maybe read the source code for hints?

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


Re: GNU gettext: Print string translated and untranslated at the same time

2023-08-18 Thread Barry via Python-list


> On 17 Aug 2023, at 15:01, c.buhtz--- via Python-list  
> wrote:
> 
> I want to display one string in its original source (untranslated) version 
> and in its translated version site by site without duplicating the string in 
> the python source code?
> It wouldn't be a big deal if it is only one word.

The key to solving this to separate the parsing of the string into the .po file 
and its translation.

def i18n(s):
  return s

msg = i18n(‘my message’)

print(_(msg))
print(msg)

Now you tell the xgettex, pygettext etc, to parse to use “i18n” to find strings 
to translate.

This is covered in the docs at 
https://docs.python.org/3/library/gettext.html#localizing-your-module

Barry





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


Re: Where is the error?

2023-08-07 Thread Barry via Python-list



> On 7 Aug 2023, at 05:28, Cameron Simpson via Python-list 
>  wrote:
> 
> Used to use a Pascal compiler once which was uncannily good at suggesting 
> where you'd missing a semicolon.

Was that on DEC VMS? It was a goal at DEC for its compilers to do this well.
They could output the errors in a machine readable format to allow editors to 
auto fix.

I am learning rust and it is very good at suggesting fixes.
There is a command to apply fixes automatically, cargo fix.

Barry




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


Re: Canonical list of Python security vulnerabilities

2023-07-14 Thread Barry via Python-list


> On 14 Jul 2023, at 19:14, Bob Kline via Python-list  
> wrote:
> 
> Can someone point me to the official catalog of security vulnerabilities in
> Python (by which I mean cpython and the standard libraries)? I found
> https://www.cvedetails.com/vulnerability-list/vendor_id-10210/product_id-18230/Python-Python.html
> but that isn't maintained by python.org. I also found
> security-annou...@python.org, but there hasn't been anything posted there
> in over a year as far as I can tell, and even before that it's pretty thin.
> 
> If there's a better place to ask, please advise.

Where do you get your python from?

You may find that the organisation that packages python that you use has such a 
list.

Barry
> 
> Thanks.
> 
> -- 
> Bob Kline
> https://www.rksystems.com
> mailto:bkl...@rksystems.com
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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


Re: Should NoneType be iterable?

2023-06-20 Thread Barry via Python-list



> On 20 Jun 2023, at 01:57, Greg Ewing via Python-list  
> wrote:
> 
> I would question the wisdom of designing an API that
> can return either a sequence or None.

I have some APIs that do return None or a list.
The None says that a list is not available and that the caller is
responsible with dealing in a application-domain specific with
with that situation.

In other cases I have API that returns a default list, often [].

It all depends on the design needs.

Barry



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


Re: Assistance Request - Issue with Installing 'pip' despite Python 3.10 Installation

2023-06-07 Thread Barry via Python-list


> On 7 Jun 2023, at 16:39, Florian Guilbault via Python-list 
>  wrote:
> 
> Dear Python Technical Team,
> 
> I hope this email finds you well. I am reaching out to you today to seek
> assistance with an issue I am facing regarding the installation of 'pip'
> despite my numerous attempts to resolve the problem.
> 
> Recently, I performed installation, uninstallation, and even repair
> operations on Python 3.10 on my computer. However, I have noticed that
> 'pip' has never been installed successfully. When I check via the command
> prompt, I receive the following error: "'pip' is not recognized as an
> internal or external command, operable program, or batch file."
> 
> I have tried several approaches to resolve this issue. I have verified that
> the PATH environment variable is correctly configured to include the path
> to the Python Scripts directory. I have also attempted to run the
> 'get-pip.py' installation script from the command line, but it did not work
> either.
> 
> I am aware that 'pip' is typically installed automatically with Python, but
> I am encountering this persistent difficulty. Therefore, I would like to
> request your assistance and expertise in resolving this 'pip' installation
> issue. I would like to be able to use 'pip' to manage my Python packages
> efficiently.
> 
> I am open to any suggestions and steps you can provide to help me resolve
> this problem. Please note that I am a user on the Windows operating system.
> 
> Thank you sincerely for your attention and support. I eagerly await your
> guidance to resolve this situation.

You can run pip like this, that works with needing to mess with your PATH.

py -m pip

Barty


> 
> Best regards,
> -- 
> https://mail.python.org/mailman/listinfo/python-list
> 

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