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

2022-02-02 Thread Chris Angelico
On Thu, 3 Feb 2022 at 13:32, Avi Gross via Python-list wrote: > > Jen, > > I would not be shocked at incompatibilities in the system described making it > hard to exchange anything, including text, but am not clear if there is a > limitation of four bytes in what can be shared. For me, a charact

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

2022-02-02 Thread Avi Gross via Python-list
@python.org Sent: Wed, Feb 2, 2022 1:27 pm Subject: Re: Data unchanged when passing data to Python in multiprocessing shared memory An ASCII string will not work.  If you convert 32894 to an ascii string you will have five bytes, but you need four.  In my original post I showed the C program I

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

2022-02-02 Thread Barry
> On 2 Feb 2022, at 18:19, Jen Kris via Python-list > wrote: > > It's not clear to me from the struct module whether it can actually > auto-detect endianness. It is impossible to auto detect endian in the general case. > I think it must be specified, just as I had to do with int.from_byte

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

2022-02-02 Thread Dennis Lee Bieber
On Wed, 2 Feb 2022 19:16:19 +0100 (CET), Jen Kris declaimed the following: >It's not clear to me from the struct module whether it can actually >auto-detect endianness.  I think it must be specified, just as I had to do >with int.from_bytes().  In my case endianness was dictated by how the four

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

2022-02-02 Thread Jen Kris via Python-list
y is also not. > > -Original Message- > From: Dennis Lee Bieber > To: python-list@python.org > Sent: Wed, Feb 2, 2022 12:30 am > Subject: Re: Data unchanged when passing data to Python in multiprocessing > shared memory > > > On Wed, 2 Feb 2022 00:40:22 +0100

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

2022-02-02 Thread Jen Kris via Python-list
It's not clear to me from the struct module whether it can actually auto-detect endianness.  I think it must be specified, just as I had to do with int.from_bytes().  In my case endianness was dictated by how the four bytes were populated, starting with the zero bytes on the left.  Feb 1, 202

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

2022-02-02 Thread Avi Gross via Python-list
m: Dennis Lee Bieber To: python-list@python.org Sent: Wed, Feb 2, 2022 12:30 am Subject: Re: Data unchanged when passing data to Python in multiprocessing shared memory On Wed, 2 Feb 2022 00:40:22 +0100 (CET), Jen Kris declaimed the following: > > breakup = int.from_bytes(byte_va

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

2022-02-02 Thread Dennis Lee Bieber
On Wed, 2 Feb 2022 00:40:22 +0100 (CET), Jen Kris declaimed the following: > > breakup = int.from_bytes(byte_val, "big") >print("this is breakup " + str(breakup)) > >Python prints:  this is breakup 32894 > >Note that I had to switch from little endian to big endian.  Python is little >endian by

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

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

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

2022-02-01 Thread Jen Kris via Python-list
Barry, thanks for your reply.  On the theory that it is not yet possible to pass data from a non-Python language to Python with multiprocessing.shared_memory, I bypassed the problem by attaching 4 bytes to my FIFO pipe message from NASM to Python: byte_val = v[10:14] where v is the message re

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

2022-02-01 Thread Barry
> On 1 Feb 2022, at 20:26, Jen Kris via Python-list > wrote: > > I am using multiprocesssing.shared_memory to pass data between NASM and > Python. The shared memory is created in NASM before Python is called. > Python connects to the shm: shm_00 = > shared_memory.SharedMemory(name='shm_

Data unchanged when passing data to Python in multiprocessing shared memory

2022-02-01 Thread Jen Kris via Python-list
I am using multiprocesssing.shared_memory to pass data between NASM and Python.  The shared memory is created in NASM before Python is called.  Python connects to the shm:  shm_00 = shared_memory.SharedMemory(name='shm_object_00',create=False).  I have used shared memory at other points in thi