<div dir="ltr"><div><font face="monospace, monospace">Traceback (most recent call last):</font></div><div><font face="monospace, monospace">  File "sharedmemory.py", line 133, in loadFromFile</font></div><div><font face="monospace, monospace">    self.sharedMemory.data()[:size] = buf.data().data[:size]</font></div><div><font face="monospace, monospace">TypeError: 'builtin_function_or_method' object is not subscriptable</font></div><div><br></div><div><br></div></div><div class="gmail_extra"><br><div class="gmail_quote">On Tue, Sep 5, 2017 at 12:12 PM, Phil Thompson <span dir="ltr"><<a href="mailto:phil@riverbankcomputing.com" target="_blank">phil@riverbankcomputing.com</a>></span> wrote:<br><blockquote class="gmail_quote" style="margin:0 0 0 .8ex;border-left:1px #ccc solid;padding-left:1ex"><span class="">On 5 Sep 2017, at 3:16 pm, Cody Scott <<a href="mailto:cody@perspexis.com">cody@perspexis.com</a>> wrote:<br>
><br>
> On Windows 10 with Python 3.6.2 and PyQt5==5.9 from PyPI I get the same traceback when I select an image.<br>
><br>
><br>
> examples\ipc\sharedmemory> python sharedmemory.py<br>
> Traceback (most recent call last):<br>
>   File "sharedmemory.py", line 132, in loadFromFile<br>
>     self.sharedMemory.data()[:] = buf.data().data()<br>
> ValueError: cannot modify the size of a sip.voidptr object<br>
><br>
> On Linux with Python 3.5.2 the example works properly.<br>
<br>
</span>What happens if you change that line to...<br>
<br>
    self.sharedMemory.data()[:<wbr>size] = buf.data().data[:size]<br>
<span class="HOEnZb"><font color="#888888"><br>
Phil<br>
</font></span><div class="HOEnZb"><div class="h5"><br>
<br>
> On Fri, Sep 1, 2017 at 11:19 PM, Wallboy <<a href="mailto:wallboy@wallboy.ca">wallboy@wallboy.ca</a>> wrote:<br>
> I need to use shared memory in my application I'm writing and I'm trying to<br>
> get the QSharedMemory example working, but I'm crashing on the following<br>
> line:<br>
><br>
> self.sharedMemory.data()[:] = buf.data().data()<br>
><br>
> Event viewer is showing the faulting application as python.exe and the<br>
> faulting module as ucrtbase.dll<br>
><br>
> Also in the example a few lines above the crashing line is this: size =<br>
> min(self.sharedMemory.size(), size) which doesn't seem to be used anywhere.<br>
><br>
> I'm using Python 3.5 and a custom build of PyQt5.9/Qt5.9. I also tried to<br>
> run the example on a older official 5.8 wheels version, but get the same<br>
> crash, so I'm pretty sure it's not related to my custom build<br>
><br>
> Just wondering if this is happening on my end only, or if there is a problem<br>
> with the example?<br>
><br>
> Thanks<br>
<br>
</div></div></blockquote></div><br></div>