My config: Python 3.9, Pycharm CE 2023.3.2, on Windows 10 Pro. Might be relevant: I’m using Qt Designer 6.4.2.
I did a Google search and found only 1 result that sort of matched, but didn’t help in the end.
I’m new to Python and still working on a tutorial. For the case of this tutorial I want to hide this warning each time the program runs:
DeprecationWarning: sipPyTypeDict() is deprecated, the extension module should use sipPyTypeDictRef() instead super().__init__() # Call __init__ of parent class.
Pycharm seems to have a way to stop/hide Python warnings. So in Pycharm I went to Settings, Editor, Inspections. Under Python section, unchecked “Deprecated function, class or …”
But the warning still shows when the program is run. How do I stop this warning from happening?
When I start developing real apps I will likely restore this warning but I have another 35 hours of tutorial to do still.
Thank you!
EDIT: Gemini AI says use @deprecated before a function call so I did this
class MainWindow(QMainWindow): # Put all widgets in this override class.
@deprecated
def __init__(self):
super().__init__() # Call __init__ of parent class.
self.initUI() # Our init function.
and still get this error:
c:\Users\MYUSER\PycharmProjects\pythonmasterclass>py ch423Qtable.py
File "c:\Users\MYUSER\PycharmProjects\pythonmasterclass\ch423Qtable.py", line 14
super().__init__() # Call __init__ of parent class.
^
SyntaxError: invalid syntax
PyCharm inspections are visual hints in PyCharm to warn you about potentially problematic code. These just affect how your code is highlighed in the editor. They don’t exist at runtime or affect the output of Python programs.
Python warnings on the other hand are part of Python. These exist at runtime and can affect the output of your program by e.g. writing to sys.stderr or being converted into exceptions.
The warning you’re seeing is a Python warning. To suppress it, you can try using the -W command line option, or configuring a warning filter at runtime with warnings.simplefilter/warnings.catch_warnings and friends.
By default, DeprecationWarning are ignored, so you probably have a configuration somewhere that’s causing it to be printed.
I’m new to Python and Pycharm. I think I see what is happening. It looks like a Debug configuration only applies to one Python file. But while doing this tutorial I will have 100s of chapters, one Python file per chapter. But I was looking for a global solution that I set once, and that worked for all files.
I don’t see a way to make a Debug config apply to all Python files.