Pyside6 QDateEdit causes system crash - qt

It seems like that in Pyside6, closing the popup of a QDateEdit causes a system crash.
MWE:
from PySide6 import QtWidgets
class DateEditGui(QtWidgets.QMainWindow):
def __init__(self):
super().__init__()
widget = QtWidgets.QWidget()
self.vertical_layout = QtWidgets.QVBoxLayout()
self.date_picker = QtWidgets.QDateEdit()
self.date_picker.setCalendarPopup(True)
self.vertical_layout.addWidget(self.date_picker)
widget.setLayout(self.vertical_layout)
self.setCentralWidget(widget)
app = QtWidgets.QApplication()
window = DateEditGui()
window.show()
app.exec_()
When I execute this script, the window appears and I can select via a click the calendar popup. When I click again on the arrow or try to close the popup in any other way, my whole system crashes.
I am on Ubuntu 22.04 with Python 3.10.6, Pyside6 version 6.4.0.1.
Is this a known Qt bug, related to Pyside6 only or an Ubuntu issue?
EDIT: The MWE works with Pyside2 and otherwise unchanged settings. Another test revealed that the QDateEdit works on Ubuntu 20.04, Python 3.9 and Pyside6.
EDIT2: This bug seems to be related to gnome-shell, since /var/log/syslog prints
gnome-shell[4736]: GNOME Shell crashed with signal 11
Unfortunately, there is no more information in the syslog.
If I switch from Wayland to Xorg, the issue is gone.

Related

IPython REPL anywhere: how to share application context with IPython console for future interaction?

IPython console is an extremely power instrument for the development. It used for research in general, application and algorithms developing both as sense catching.
Does there is a way to connect current context of Python app with IPython console? Like import ipyconsole; ipyconsole.set_interactive_from_here().
Here is much more complete situation.
First flow.
Below is some sort of running python app with inited DB and web-app route.
class App:
def __init__(self):
self.db = DB.new_connection("localhost:27018")
self.var_A = "Just an example variable"
def run(self):
self.console = IPythonAppConsole(self) #Console Creation
self.console.initialize()
self.kernel = console.start()
# print(self.kernel.connection_file)
# << "kernel-12345.json"
# let the app be some kind of web/flask application
#app.route('/items/<item_id>')
def get_item(self, item_id=0):
### GOOD PLACE for
### <import ipyconsole; ipyconsole.set_interactive_from_here(self.kernel)> CODE
item = self.db.find_one({'_id': item_id})
print(item)
Second interactive flow. This is a valuable target.
$: ipython console --existing "kernel-12345.json"
<< print(self.db.uri)
>> "localhost:27018"
<< print(item_id)
>> 1234567890
Does there is a common sense way to implement these two flows? Maybe there is some sort of magic combination of pdb and ipython kernel?
By the way there are another interactive ways to communicate with applications:
Debugging. Debug app with pdb/ipdb/web-pdb, using such snipper import pdb; pdb.set_trace() in any line in code.
Generate IPython notebook snippet from python code. Anywhere pyvt.
Today I looking for the answer inside IPython/shellapp, kernelapp sources with Jupyter console and dynamic variable sharing through Redis. Thanks for any kind of ideas!
Maybe Flask shell is what you are looking for https://flask.palletsprojects.com/en/1.1.x/shell/
One possible way for you to achieve this is to use ipdb and iPython combo.
x = 2
ipdb.set_trace()
x = 4
When you run the code, it drops into a ipdb shell
❯ python3 test.py
> /Users/tarunlalwani/Documents/Projects/SO/opa/test.py(7)<module>()
5 ipdb.set_trace()
6
----> 7 x = 4
ipdb>
And then you can drop into a ipython shell from there
ipdb> from IPython import embed
ipdb> embed()
Python 3.9.1 (default, Jan 8 2021, 17:17:43)
Type 'copyright', 'credits' or 'license' for more information
IPython 7.19.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: x
Out[1]: 2
In [2]:

Bokeh server is not recognized

Trying to run simple app from Kevin Jolly's Hands-On Data Visualization with Bokeh Packt.
#Import the required packages
from bokeh.layouts import widgetbox
from bokeh.models import Slider
from bokeh.io import curdoc
#Create a slider widget
slider_widget = Slider( start = 0, end = 100, step = 10, title = 'Single Slider')
#Create a layout for the widget
slider_layout = widgetbox( slider_widget)
#Add the slider widget to the application
curdoc(). add_root( slider_layout)
Then tried to start bokeh server:
...\Python_Scripts\Sublime> bokeh serve --show bokeh.py
bokeh : The term 'bokeh' is not recognized as the name of a cmdlet, function, script file, or operable program.
bokeh info
Python version : 3.7.3 (default, Apr 24 2019, 15:29:51) [MSC v.1915 64 bit (AMD64)]
IPython version : 7.8.0
Tornado version : 6.0.3
Bokeh version : 1.3.4
BokehJS static path : C:\Users\k S\Anaconda3\lib\site-packages\bokeh\server\static
node.js version : (not installed)
npm version : (not installed)
Previous post with same problem did not provide working solution, please help.
First I would strongly suggest renaming your file to something other than bokeh.py. Due to the way Python itself works, this can sometimes result in Python trying to load the wrong module.
It's exceedingly strange that bokeh info could work but bokeh serve would not, since they are subcommands of literally the same program file. If renaming the script does not help, then you can always invoke the server using the Python -m command line option:
python -m bokeh serve --show app.py
If this does not work it can mean one thing only: the python executable you are running is a different Python environment than the one that you installed Bokeh into.

GoLang debugger chokes on stdin

I have a problem using GoLand's debugger for a piece of code that tries to read from the stdin. For example, the following code:
package main
import (
"io"
"os"
"strings"
)
func main() {
io.Copy(os.Stdout, strings.NewReader("Start typing now...\n"))
io.Copy(os.Stdout, os.Stdin)
}
executes perfectly when I run it from within GoLand - the console window collects the input properly. But when I use the debug command - I can see the my input appearing in the console window, but the enter key will not end the input string, instead the cursor just moves to the next line.
My versions:
GoLand 2018.2.2
Build #GO-182.4129.57, built on August 23, 2018
JRE: 1.8.0_152-release-1248-b8 x86_64
JVM: OpenJDK 64-Bit Server VM by JetBrains s.r.o
macOS 10.13.6
As you are using OSX there is no simple way to get this working.
Assuming you are using Go 1.10 or newer, change the directory to $GOPATH/src/github.com/user/package, then compile your application using go build -gcflags "all=-N -l" github.com/user/package, and then manually start the application in Terminal manually. Once the application runs, go to Run | Attach to Process... and select the application from the list. This will attach the debugger to the running application.
Please note that the compilation step is needed in order to improve the debugging experience but you should not use the resulting binary in production as (almost) all optimizations have been turned off.

pyside qt4.8 os x core profile/3.2 compatibility (yes, I've read the other posts)

No matter what I've tried, I cannot get a proper 3.2 context in pyside using qt 4.8. I have triple checked via the gl extensions manager, and my computer is certainly capable (100% of 4.1 core features).
"simple" version doesn't work...
f = QGLFormat()
f.setProfile(QGLFormat.CoreProfile)
f.setVersion(3,2)
QGLFormat.setDefaultFormat(f)
In fact, I cannot even successfully create a glcontext...
class GLView(QGLWidget):
def __init__(self,name,parent=None):
QGLWidget.__init__(self,parent)
c = QGLContext(QGLFormat())
logger.critical(c.create()) #returns False
This is after a QApplication exists and a MainWindow class is created and shown...
If I try to set the format on the built-in QGLWidget context, it fails as well --
self.context().setFormat(f)
self.context().makeCurrent()
"Cannot make invalid context current". Similarly does not work even if coreprofile is not specified, and version is set at 2.1.
Moving any of these to the initializeGL callback makes no difference.
I've looked at the following questions, which have not resolved my issue
PyQt4 OpenGL: Enabling OpenGL Core Profile - solution was to move to qt5 (no official pyside release for this yet)
PyOpenGL cannot compile shader - on debian, does not have same problem as os x
Getting OpenGL context newer than 2.1 with Qt 4 and Mavericks - unresolved
Qt & OpenGL OS X: GLSL shader version only 120 on Mountain Lion - c++, same code does not work in pyside, as seen above
Any help on this would be greatly appreciated.
Thanks,
K

In Ipython Qt Console sp.info doesn't print inside the console

I have installed IPython 1.1.0, in Ubuntu 12.04 from the source.
Similarly I have installed Numpy-1.8.0, Scipy-0.13.1, Matplotlib-1.3.1 from the source.
When I use the Ipython Qt COnsole the command sp.info(optimize.fmin) doesn't print the output in console but it prints it in the terminal (pylab). Is there anyway that it can print it in console too.
import numpy as np
import scipy as sp
from scipy import optimize
sp.info(optimize.fmin)
The output is like this in pylab
fmin(func, x0, args=(), xtol=0.0001, ftol=0.0001, maxiter=None, maxfun=None,
full_output=0, disp=1, retall=0, callback=None)
Minimize a function using the downhill simplex algorithm.
Parameters
----------
func : callable func(x,*args)
You can use IPython's ? syntax to get information about any object:
optimize.fmin?
That will work in all IPython environments.
However, scipy.info() and numpy.info() both work in the Qt console when I try them, whether or not I start it in pylab mode. I'm not sure why they don't for you.

Resources