titusjan / objbrowser Goto Github PK
View Code? Open in Web Editor NEWGUI for Python object introspection
License: MIT License
GUI for Python object introspection
License: MIT License
Python 3.9 seems to work totally fine, but with Python 3.10 when calling the browse
function:
Python 3.10.9 (main, Dec 7 2022, 01:11:56) [GCC 7.5.0]
Type 'copyright', 'credits' or 'license' for more information
IPython 8.4.0 -- An enhanced Interactive Python. Type '?' for help.
In [1]: from objbrowser import browse
In [2]: browse({"Hello": 1})
---------------------------------------------------------------------------
TypeError Traceback (most recent call last)
Input In [2], in <cell line: 1>()
----> 1 browse({"Hello": 1})
File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/__init__.py:45, in browse(*args, **kwargs)
42 def browse(*args, **kwargs):
43 """ Opens and executes an ObjectBrowser window
44 """
---> 45 ObjectBrowser.browse(*args, **kwargs)
File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:627, in ObjectBrowser.browse(cls, *args, **kwargs)
624 logger.info("Using Python {}".format(PYTHON_VERSION))
625 logger.info("Using {} (api {}, qtpy: {})".format(QT_API_NAME, QT_API, QTPY_VERSION))
--> 627 cls.create_browser(*args, **kwargs)
628 exit_code = cls.execute()
629 return exit_code
File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:598, in ObjectBrowser.create_browser(cls, *args, **kwargs)
594 logger.debug("Reusing existing QApplication instance")
596 cls._q_app = q_app # keeping reference to prevent garbage collection.
--> 598 object_browser = cls(*args, **kwargs)
599 object_browser.show()
600 object_browser.raise_()
File ~/Git/hardware-tooling/venv-10/lib/python3.10/site-packages/objbrowser/objectbrowser.py:107, in ObjectBrowser.__init__(self, obj, name, attribute_columns, attribute_details, show_callable_attributes, show_special_attributes, auto_refresh, refresh_rate, reset)
105 assert self._refresh_rate > 0, "refresh_rate must be > 0. Got: {}".format(self._refresh_rate)
106 self._refresh_timer = QtCore.QTimer(self)
--> 107 self._refresh_timer.setInterval(self._refresh_rate * 1000)
108 self._refresh_timer.timeout.connect(self.refresh)
110 # Update views with model
TypeError: setInterval(self, int): argument 1 has unexpected type 'float'
Version:
objbrowser==1.3.0
Tested on 3.9 and 3.10
Thank you for providing the object browser.
It'd nice to have a search field where one can look for specific methods and fields.
I install PyQt6 and use this code:
from objbrowser import browse
a = 16; b = 'hello'
browse(locals())
It gives this error:
Traceback (most recent call last):
File "D:\QC supplements\Code\Apps\Trấn Kỳ\test.py", line 3, in <module>
browse(locals())
File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\__init__.py", line 45, in browse
ObjectBrowser.browse(*args, **kwargs)
File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 627, in browse
cls.create_browser(*args, **kwargs)
File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 598, in create_browser
object_browser = cls(*args, **kwargs)
^^^^^^^^^^^^^^^^^^^^
File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 99, in __init__
self._setup_menu()
File "C:\Users\ganuo\AppData\Local\Programs\Python\Python311\Lib\site-packages\objbrowser\objectbrowser.py", line 202, in _setup_menu
file_menu.addAction("C&lose", self.close, "Ctrl+W")
TypeError: arguments did not match any overloaded call:
addAction(self, icon: QIcon, text: Optional[str]): argument 1 has unexpected type 'str'
addAction(self, icon: QIcon, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 1 has unexpected type 'str'
addAction(self, icon: QIcon, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 1 has unexpected type 'str'
addAction(self, text: Optional[str]): too many arguments
addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int]): argument 2 has unexpected type 'builtin_function_or_method'
addAction(self, text: Optional[str], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 3 has unexpected type 'str' addAction(self, text: Optional[str], shortcut: Union[QKeySequence, QKeySequence.StandardKey, Optional[str], int], slot: PYQT_SLOT, type: Qt.ConnectionType = Qt.AutoConnection): argument 2 has unexpected type 'builtin_function_or_method'
addAction(self, action: typing.Optional[QAction]): argument 1 has unexpected type 'str'
Why is that?
Hey there!
Thank you for this, it's extremely useful!
Still I'm trying to figure out how I can run the browser without blocking the REPL, so that I can check the dumped data for what I need and go on in the REPL with the window open as a reference if I need it again.
I'm a bit naive and don't know much about QT, is it possible to launch the browser in a separate thread or something similar so to have the REPL free to continue?
Thank you for time!
Hello,
I've tried objbrowser with Python 3.11 and PySide 6.4, but throws following exception:
File "C:\path\objbrowser\objectbrowser.py", line 275, in _setup_views
self.button_group.buttonClicked[int].connect(self._change_details_field)
~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~^^^^^
IndexError: Signature "buttonClicked(int)" not found for signal: "buttonClicked". Available candidates: "buttonClicked(QAbstractButton*)"
If i replace that with self.button_group.buttonClicked.connect(self._change_details_field)
and it's running now without issues.
I've also replaced line 539 with self.button_group.buttonClicked.disconnect(self._change_details_field)
, or it throws the same error.
I have no idea about compatibility with other Pyside or Python versions for that fix ...
A declarative, efficient, and flexible JavaScript library for building user interfaces.
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
An Open Source Machine Learning Framework for Everyone
The Web framework for perfectionists with deadlines.
A PHP framework for web artisans
Bring data to life with SVG, Canvas and HTML. 📊📈🎉
JavaScript (JS) is a lightweight interpreted programming language with first-class functions.
Some thing interesting about web. New door for the world.
A server is a program made to process requests and deliver data to clients.
Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.
Some thing interesting about visualization, use data art
Some thing interesting about game, make everyone happy.
We are working to build community through open source technology. NB: members must have two-factor auth.
Open source projects and samples from Microsoft.
Google ❤️ Open Source for everyone.
Alibaba Open Source for everyone
Data-Driven Documents codes.
China tencent open source team.