From 839ad486f854c5c4aba2205a1fcf41c4e7524c19 Mon Sep 17 00:00:00 2001 From: Luke Campagnola Date: Tue, 11 Sep 2018 07:14:28 -0700 Subject: [PATCH] Flush shared memory file before attempting to map This avoids the error "ValueError: mmap length is greater than file size" on OSX. (see #730) --- pyqtgraph/widgets/RemoteGraphicsView.py | 1 + 1 file changed, 1 insertion(+) diff --git a/pyqtgraph/widgets/RemoteGraphicsView.py b/pyqtgraph/widgets/RemoteGraphicsView.py index a1674cc2..edf4db3c 100644 --- a/pyqtgraph/widgets/RemoteGraphicsView.py +++ b/pyqtgraph/widgets/RemoteGraphicsView.py @@ -152,6 +152,7 @@ class Renderer(GraphicsView): else: self.shmFile = tempfile.NamedTemporaryFile(prefix='pyqtgraph_shmem_') self.shmFile.write(b'\x00' * (mmap.PAGESIZE+1)) + self.shmFile.flush() fd = self.shmFile.fileno() self.shm = mmap.mmap(fd, mmap.PAGESIZE, mmap.MAP_SHARED, mmap.PROT_WRITE) atexit.register(self.close)