Re: Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread Peter J. Holzer via Python-list
On 2023-10-02 19:44:12 +0300, אורי via Python-list wrote:
> I have an issue since about 5 months now. Python 3.12.0 venv not working
> with psycopg2 on Windows. I created 2 issues on GitHub but they were
> closed. I checked today with the new Python release but it's still not
> working.
> 
> https://github.com/psycopg/psycopg2/issues/1578
> https://github.com/python/cpython/issues/104830

You wil have to come up with a *minimal* test case which reproduces the
problem. Expecting people to download and test your massive application
is unreasonable.

hp

-- 
   _  | Peter J. Holzer| Story must make more sense than reality.
|_|_) ||
| |   | h...@hjp.at |-- Charles Stross, "Creative writing
__/   | http://www.hjp.at/ |   challenge!"


signature.asc
Description: PGP signature
-- 
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 Jen Kris via Python-list
Dieter, thanks for your comment that:

* In your code, `offset` is `0`, `1`, `2`, ...
but it should be `0 *8`, `1 * 8`, `2 * 8`, ...

But you concluded with essentially the same solution proposed by MRAB, so that 
would obviate the need to write item by item because it writes the whole buffer 
at once.  

Thanks for your help.  


Oct 2, 2023, 17:47 by die...@handshake.de:

> Jen Kris wrote at 2023-10-2 00:04 +0200:
> >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)
>
>>
>>
> >for offset in range(len(qs_array)):
>
>> item_to_write= bytes(qs_array[offset])
>>  struct.pack_into(buf,">
> >But I get the error "struct.error: embedded null character."
>
> You made a lot of errors:
>
>  * the signature of `struct.pack_into` is
>  `(format, buffer, offset, v1, v2, ...)`.
>  Especially: `format` is the first, `buffer` the second argument
>
>  * In your code, `offset` is `0`, `1`, `2`, ...
>  but it should be `0 *8`, `1 * 8`, `2 * 8`, ...
>
>  * The `vi` should be something which fits with the format:
>  integers in your case. But you pass bytes.
>
> Try `struct.pack_into(" instead of your loop.
>
>
> Next time: carefully read the documentation and think carefully
> about the types involved.
>

-- 
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 Dieter Maurer via Python-list
Jen Kris wrote at 2023-10-2 00:04 +0200:
>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)
>
>for offset in range(len(qs_array)):
>  item_to_write= bytes(qs_array[offset])
>  struct.pack_into(buf,"
>But I get the error "struct.error: embedded null character."

You made a lot of errors:

 * the signature of `struct.pack_into` is
   `(format, buffer, offset, v1, v2, ...)`.
   Especially: `format` is the first, `buffer` the second argument

 * In your code, `offset` is `0`, `1`, `2`, ...
   but it should be `0 *8`, `1 * 8`, `2 * 8`, ...

 * The `vi` should be something which fits with the format:
   integers in your case. But you pass bytes.

Try `struct.pack_into("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 Jen Kris via Python-list
Thanks very much, MRAB.  I just tried that and it works.  What frustrated me is 
that every research example I found writes integers as strings.  That works -- 
sort of -- but it requires re-casting each string to integer when reading the 
file.  If I'm doing binary work I don't want the extra overhead, and it's more 
difficult yet if I'm using the Python integer output in a C program.  Your 
solution solves those problems.  



Oct 2, 2023, 17:11 by python-list@python.org:

> On 2023-10-01 23:04, 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)
>>
>> foroffset in range(len(qs_array)):
>>
>> item_to_write= bytes(qs_array[offset])
>>
>> struct.pack_into(buf,">
>> ButI get the error "struct.error: embedded null character."
>>
>> Maybethere's a better way to do this?
>>
> You can't pack into a 'bytes' object because it's immutable.
>
> The simplest solution I can think of is:
>
> buf = struct.pack("<%sQ" % len(qs_array), *qs_array)
> -- 
> https://mail.python.org/mailman/listinfo/python-list
>

-- 
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 MRAB via Python-list

On 2023-10-01 23:04, 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)
>
> foroffset in range(len(qs_array)):
>
> item_to_write= bytes(qs_array[offset])
>
> struct.pack_into(buf,"
> ButI get the error "struct.error: embedded null character."
>
> Maybethere's a better way to do this?
>
You can't pack into a 'bytes' object because it's immutable.

The simplest solution I can think of is:

buf = struct.pack("<%sQ" % len(qs_array), *qs_array)
--
https://mail.python.org/mailman/listinfo/python-list


Python 3.12.0 venv not working with psycopg2

2023-10-02 Thread אורי via Python-list
Hi,

I have an issue since about 5 months now. Python 3.12.0 venv not working
with psycopg2 on Windows. I created 2 issues on GitHub but they were
closed. I checked today with the new Python release but it's still not
working.

https://github.com/psycopg/psycopg2/issues/1578
https://github.com/python/cpython/issues/104830

Thanks,
Uri.
אורי
u...@speedy.net
-- 
https://mail.python.org/mailman/listinfo/python-list


[Python-announce] Python 3.12.0 (final) now available.

2023-10-02 Thread Thomas Wouters
Finally, it’s final! The final release of Python 3.12.0 (final) is here!

https://www.python.org/downloads/release/python-3120/
This is the stable release of Python 3.12.0

Python 3.12.0 is the newest major release of the Python programming
language, and it contains many new features and optimizations.
Major
new features of the 3.12 series, compared to 3.11
New
features

   - More flexible f-string parsing
   
,
   allowing many things previously disallowed (PEP 701
   ).
   - Support for the buffer protocol
   

   in Python code (PEP 688 ).
   - A new debugging/profiling API
   

   (PEP 669 ).
   - Support for isolated subinterpreters
   

   with separate Global Interpreter Locks (PEP 684
   ).
   - Even more improved error messages
   .
   More exceptions potentially caused by typos now make suggestions to the
   user.
   - Support for the Linux perf profiler
    to report
   Python function names in traces.
   - Many large and small performance improvements
    (like PEP
   709  and support for the BOLT binary
   optimizer), delivering an estimated 5% overall performance improvement.

Type
annotations

   - New type annotation syntax
   

   for generic classes (PEP 695 ).
   - New override decorator
   

   for methods (PEP 698 ).


Deprecations

   - The deprecated wstr and wstr_length members of the C implementation of
   unicode objects were removed, per PEP 623
   .
   - In the unittest module, a number of long deprecated methods and
   classes were removed. (They had been deprecated since Python 3.1 or 3.2).
   - The deprecated smtpd and distutils modules have been removed (see PEP
   594  and PEP 632
   . The setuptools package continues to
   provide the distutils module.
   - A number of other old, broken and deprecated functions, classes and
   methods  have
   been removed.
   - Invalid backslash escape sequences in strings now warn with
   SyntaxWarning instead of DeprecationWarning, making them more visible.
   (They will become syntax errors in the future.)
   - The internal representation of integers has changed in preparation for
   performance enhancements. (This should not affect most users as it is an
   internal detail, but it may cause problems for Cython-generated code.)

For more details on the changes to Python 3.12, see What’s new in Python
3.12 .
More
resources

   - Online Documentation .
   - PEP 693 , the Python 3.12
   Release Schedule.
   - Report bugs via GitHub Issues
   .
   - Help fund Python and its community
   .

And
now for something completely different

They have no need of our help
So do not tell me
These haggard faces could belong to you or me
Should life have dealt a different hand
We need to see them for who they really are
Chancers and scroungers
Layabouts and loungers
With bombs up their sleeves
Cut-throats and thieves
They are not
Welcome here
We should make them
Go back to where they came from
They cannot
Share our food
Share our homes
Share our countries
Instead let us
Build a wall to keep them out
It is not okay to say
These are people just like us
A place should only belong to those who are 

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


Python 3.12.0 (final) now available.

2023-10-02 Thread Thomas Wouters via Python-list
Finally, it’s final! The final release of Python 3.12.0 (final) is here!

https://www.python.org/downloads/release/python-3120/
This is the stable release of Python 3.12.0

Python 3.12.0 is the newest major release of the Python programming
language, and it contains many new features and optimizations.
Major
new features of the 3.12 series, compared to 3.11
New
features

   - More flexible f-string parsing
   
,
   allowing many things previously disallowed (PEP 701
   ).
   - Support for the buffer protocol
   

   in Python code (PEP 688 ).
   - A new debugging/profiling API
   

   (PEP 669 ).
   - Support for isolated subinterpreters
   

   with separate Global Interpreter Locks (PEP 684
   ).
   - Even more improved error messages
   .
   More exceptions potentially caused by typos now make suggestions to the
   user.
   - Support for the Linux perf profiler
    to report
   Python function names in traces.
   - Many large and small performance improvements
    (like PEP
   709  and support for the BOLT binary
   optimizer), delivering an estimated 5% overall performance improvement.

Type
annotations

   - New type annotation syntax
   

   for generic classes (PEP 695 ).
   - New override decorator
   

   for methods (PEP 698 ).


Deprecations

   - The deprecated wstr and wstr_length members of the C implementation of
   unicode objects were removed, per PEP 623
   .
   - In the unittest module, a number of long deprecated methods and
   classes were removed. (They had been deprecated since Python 3.1 or 3.2).
   - The deprecated smtpd and distutils modules have been removed (see PEP
   594  and PEP 632
   . The setuptools package continues to
   provide the distutils module.
   - A number of other old, broken and deprecated functions, classes and
   methods  have
   been removed.
   - Invalid backslash escape sequences in strings now warn with
   SyntaxWarning instead of DeprecationWarning, making them more visible.
   (They will become syntax errors in the future.)
   - The internal representation of integers has changed in preparation for
   performance enhancements. (This should not affect most users as it is an
   internal detail, but it may cause problems for Cython-generated code.)

For more details on the changes to Python 3.12, see What’s new in Python
3.12 .
More
resources

   - Online Documentation .
   - PEP 693 , the Python 3.12
   Release Schedule.
   - Report bugs via GitHub Issues
   .
   - Help fund Python and its community
   .

And
now for something completely different

They have no need of our help
So do not tell me
These haggard faces could belong to you or me
Should life have dealt a different hand
We need to see them for who they really are
Chancers and scroungers
Layabouts and loungers
With bombs up their sleeves
Cut-throats and thieves
They are not
Welcome here
We should make them
Go back to where they came from
They cannot
Share our food
Share our homes
Share our countries
Instead let us
Build a wall to keep them out
It is not okay to say
These are people just like us
A place should only belong to those who are 

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

2023-10-02 Thread Jen Kris via Python-list

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)

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


[Python-announce] Wing Python IDE version 9.1.2

2023-10-02 Thread Wingware
Wing Python IDE version 9.1.2 has been released with improved 
auto-import and fixes for debugging with mingw Windows Python builds, 
creating projects when multiple  windows are open, auto-editing inside 
f-strings, and about 20 other improvements.


Details: https://wingware.com/news/2023-09-28
Downloads: https://wingware.com/downloads

== About Wing ==

Wing is a full-featured but light-weight Python IDE designed 
specifically for Python, with powerful editing, code inspection, 
testing, and debugging capabilities. Wing's deep code analysis provides 
auto-completion, auto-editing, code navigation, early error detection, 
and refactoring that speed up development. Its top notch debugger works 
with any Python code, locally or on a remote host, container, or 
cluster. Wing also supports test-driven development, version control, 
Python package management, UI color and layout customization, and 
includes extensive documentation and support.


Wing is available in three product levels:  Wing Pro is the 
full-featured Python IDE for professional developers, Wing Personal is a 
free Python IDE for students and hobbyists (omits some features), and 
Wing 101 is a very simplified free Python IDE for beginners (omits many 
features).


Learn more at https://wingware.com/



___
Python-announce-list mailing list -- python-announce-list@python.org
To unsubscribe send an email to python-announce-list-le...@python.org
https://mail.python.org/mailman3/lists/python-announce-list.python.org/
Member address: arch...@mail-archive.com