[PyQt] QSharedMemory Example Crashing

Phil Thompson phil at riverbankcomputing.com
Tue Sep 5 17:12:39 BST 2017

On 5 Sep 2017, at 3:16 pm, Cody Scott <cody at perspexis.com> wrote:
> On Windows 10 with Python 3.6.2 and PyQt5==5.9 from PyPI I get the same traceback when I select an image.
> examples\ipc\sharedmemory> python sharedmemory.py
> Traceback (most recent call last):
>   File "sharedmemory.py", line 132, in loadFromFile
>     self.sharedMemory.data()[:] = buf.data().data()
> ValueError: cannot modify the size of a sip.voidptr object
> On Linux with Python 3.5.2 the example works properly.

What happens if you change that line to...

    self.sharedMemory.data()[:size] = buf.data().data[:size]


> On Fri, Sep 1, 2017 at 11:19 PM, Wallboy <wallboy at wallboy.ca> wrote:
> I need to use shared memory in my application I'm writing and I'm trying to
> get the QSharedMemory example working, but I'm crashing on the following
> line:
> self.sharedMemory.data()[:] = buf.data().data()
> Event viewer is showing the faulting application as python.exe and the
> faulting module as ucrtbase.dll
> Also in the example a few lines above the crashing line is this: size =
> min(self.sharedMemory.size(), size) which doesn't seem to be used anywhere.
> I'm using Python 3.5 and a custom build of PyQt5.9/Qt5.9. I also tried to
> run the example on a older official 5.8 wheels version, but get the same
> crash, so I'm pretty sure it's not related to my custom build
> Just wondering if this is happening on my end only, or if there is a problem
> with the example?
> Thanks

More information about the PyQt mailing list