Fix 'import pyqtgraph.canvas' crash#2934
Conversation
51fce79 to
8a3feb7
Compare
Just importing pyqtgraph.canvas causes the interpreter to crash. Saving the `SINGLETON` after the call to `QObject.__init__` solves the issue. Fix pyqtgraph#2838
8a3feb7 to
ba395e7
Compare
|
Thanks @nicoddemus I'm curious, so you use the canvas module? |
|
Hey @j9ac9k! Not directly, I just hit pyinstaller/pyinstaller#7991 while playing around with pyinstaller, and decided to contribute a fix. 👍 |
|
Hi @j9ac9k, will this be in the next upcoming release? if so, when is the expected release date? Thank you very much |
😅 I'm awful at predicting when I'm going to do a release. I recently moved across the country and have been dealing with everyone in my household getting sick... there are some PRs I would want to merge before the next release, and ideally I would fix a regression I introduced in the SVG exporter... anyway I have no idea when I'm going to do it. No doubt that my other responsibilities have pulled me away from this project... hoping to resume my work before much longer. |
|
in that case, for anyone facing this issue, consider installing pyqtgraph from source, instead of via pip. It helped for my project using PyQt6 and pyqtgraph when I was freezing it using PyInstaller. |
|
I generally try and cut releases shortly after breakages are addressed, i didn't realize this issue was impacting so many pyinstaller users. |
|
@j9ac9k anything I can help with to get this into a new release? Seems minor but this prevents users from using pyinstaller. I would like to do some testing with |
I had been holding off on a fix until I can resolve #2491. I should point out that the issue is poorly written (I'm the author, I need to spend some more time rewriting and be more specific with the intricacies 🙃 ), but given the series of fixes that have been submitted since the last release (including the pyinstaller issue addressed here), I have come to the conclusion that I should undo the "bug-fix" I made (which included a regression described in #2941) and work on a better way to resolve #2661 Sorry @meganbkratz I'm going to have to roll back the bug fix for your issue for a while I hope to cut a release in the next 24 hours. Thanks for following up @nicoddemus ...if you have some time/interest, I would love your assistance with re-fixing #2661 after I cut this next release. |
|
Awesome, thanks a lot @j9ac9k, appreciate it!
To be honest, I know almost nothing about |
|
@j9ac9k No worries about rolling back the svg exporter fix. I have a workaround (subtracting out a constant to make the axis values smaller), so it's not urgent. Thank you for your work on it!!! |
Fair enough, issue referenced isn't something requiring lots of tinkering in the pyqgraph codebase or knowledge of its working. My PR did one attempt to workaround for Qt's implementation of painting QSvgGenerator object https://github.com/pyqtgraph/pyqtgraph/blob/master/pyqtgraph/exporters/SVGExporter.py#L268-L273 The numbers to the output XML where the precision is lots (so exporting a line that has points with a large numerical value in x (or y), but the values are similar/close together, you'll lost the precision. My attempt to work around this is to move the line/curve to be between (-1, 1) and then write the SVG out. I suspect there is some more fanciness we can do with applying a transform to the graphics items, and then setting the @meganbkratz Thanks for chiming in and for your understanding 👍🏻 |
Just importing pyqtgraph.canvas causes the interpreter to crash.
Saving the
SINGLETONafter the call toQObject.__init__solves the issue.Fix #2838