Giter VIP home page Giter VIP logo

qtinter's People

Contributors

fancidev avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar  avatar  avatar

Forkers

mfkiwl zbx911

qtinter's Issues

tests #95 error

Python-3.7-PySide6-windows-latest

Run coverage run --source=src --append --branch -m unittest discover -s tests
  coverage run --source=src --append --branch -m unittest discover -s tests
  shell: C:\Program Files\PowerShell\7\pwsh.EXE -command ". '{0}'"
  env:
    pythonLocation: C:\hostedtoolcache\windows\Python\3.7.9\x64
    PKG_CONFIG_PATH: C:\hostedtoolcache\windows\Python\3.7.9\x64/lib/pkgconfig
    Python_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
    Python2_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
    Python3_ROOT_DIR: C:\hostedtoolcache\windows\Python\3.7.9\x64
    TEST_QT_MODULE: PySide6
    PYTHONPATH: src

...

======================================================================
ERROR: test_wrapped_static_amethod (test_slot.TestSlot)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "D:\a\qtinter\qtinter\tests\test_slot.py", line 482, in test_wrapped_static_amethod
    result = self._run_once()
  File "D:\a\qtinter\qtinter\tests\test_slot.py", line 234, in _run_once
    with using_asyncio_from_qt():
  File "c:\hostedtoolcache\windows\python\3.7.9\x64\lib\contextlib.py", line 112, in __enter__
    return next(self.gen)
  File "D:\a\qtinter\qtinter\src\qtinter\_contexts.py", line 36, in using_asyncio_from_qt
    loop.start()
  File "D:\a\qtinter\qtinter\src\qtinter\_base_events.py", line 284, in start
    self._qi_loop_startup()
  File "D:\a\qtinter\qtinter\src\qtinter\_base_events.py", line 302, in _qi_loop_startup
    self.__notifier = _create_notifier(self)
  File "D:\a\qtinter\qtinter\src\qtinter\_base_events.py", line 57, in _create_notifier
    return _QiNotifierObject(loop)
AttributeError: __init__

----------------------------------------------------------------------
Ran 59 tests in 0.163s

FAILED (errors=30, skipped=7)
Error: Process completed with exit code 1.

There are 30 error of the same cause AttributeError: __init__.

some error on run_in_executor?

class Ui_hexeditorDialog(object):
def setupUi(self, hexeditorDialog):
hexeditorDialog.setObjectName("hexeditorDialog")
hexeditorDialog.resize(857, 766)
icon = QtGui.QIcon()
icon.addPixmap(QtGui.QPixmap(":/png/images/ui-combo-box-edit.png"), QtGui.QIcon.Normal, QtGui.QIcon.Off)
hexeditorDialog.setWindowIcon(icon)

    self.retranslateUi(hexeditorDialog)
    QtCore.QMetaObject.connectSlotsByName(hexeditorDialog)

def retranslateUi(self, hexeditorDialog):
    _translate = QtCore.QCoreApplication.translate
    hexeditorDialog.setWindowTitle(_translate("hexeditorDialog", "hexeditorDialog"))

class BaseDialog(QtWidgets.QDialog):
def init(self,parent=None, *args):
super(BaseDialog, self).init(*args)
self.setWindowModality(True) # 非模态

class HexEditorDialog(BaseDialog, Ui_Dialog):
# asyncsignal()
def init(self, parent=None, device=None, *args):
super(HexEditorDialog, self).init(*args)

    self.setupUi(self)
    self.parent = parent
    self.device = device
    if self.device is None:
        self.parent.log("[E] device is None")
        return

async def dialog_exec_(self,dialog_class):
def run_dialog(dialog, loop):

        dialog.activateWindow()
        dialog.setWindowState(dialog.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
        dialog.showNormal()
        # dialog.show()
        dialog.exec_()


    # if dialog_class in self.sub_dialog and self.sub_dialog[dialog_class].isActiveWindow():
    if dialog_class in self.sub_dialog:
        dialog = self.sub_dialog[dialog_class]
        dialog.activateWindow()  
        # dialog.setWindowState(dialog.windowState() & ~Qt.WindowMinimized | Qt.WindowActive)
        dialog.show()
        return


    serial = self.qcbox_devices.currentText()
    d = await self.adb.device(serial)
    dialog = dialog_class(self, d)
    loop = asyncio.get_running_loop()
    self.sub_dialog[dialog_class]=dialog

    import concurrent.futures
    with concurrent.futures.ThreadPoolExecutor() as pool:
         await loop.run_in_executor(pool, functools.partial(run_dialog, dialog), loop)
    # await loop.run_in_executor(None, functools.partial(run_dialog, dialog), loop)

if name == "main":
try:
app = QApplication(sys.argv)
QApplication.setStyle('Fusion')
win = DataInspectorDialog()
win.show()
with qtinter.using_asyncio_from_qt():
app.exec()
except asyncio.exceptions.CancelledError:
sys.exit(0)

[error] error in run Qprocess!!!!

import asyncio
import functools
import os

import sys
import time

import aiofiles
import qtinter
from PyQt5 import QtCore
from PyQt5.QtCore import QObject, pyqtSignal, Qt
from PyQt5.QtGui import QTextCursor
from PyQt5.QtWidgets import QApplication
from aiofiles.os import mkdir

from adb_gui_async.ui.logcat import Ui_logcat_Dialog

from adb_gui_async.ui_component.BaseDialog import BaseDialog

from ui.logcat import Ui_Dialog as Ui_logcat_Dialog
from ui_component.BaseDialog import BaseDialog

class LogcatOutputDialog(BaseDialog, Ui_logcat_Dialog):
# appendSignal = pyqtSignal(str)
def init(self, parent=None, device=None, *args):
super(LogcatOutputDialog, self).init(*args)
self.parent = parent
self.device = device
self.setupUi(self)
# self.textBrowserConsole.setStyleSheet("background:#f0f0f0")
# https://blog.csdn.net/venture5/article/details/121423286
# todo 实时显示输出, 将控制台的输出重定向到界面中
self._process = QtCore.QProcess()

    self.pushButton_Clear.clicked.connect(self.on_clear_log)

    self.checkBox_Print.stateChanged.connect(self.on_print)


    # self.appendSignal.connect(self.update_text)
    # self.appendToTextEdit = self.appendSignal.emit


    self.f=None
def start_log(self, program, arguments=None):
    if arguments is None:
        arguments = []

    self._process.readyReadStandardOutput.connect(self.handle_stdout)
    self._process.readyReadStandardError.connect(self.handle_stderr)
    self._process.start(program, arguments)
@qtinter.asyncslot
async def handle_stdout(self):
    message = self._process.readAllStandardOutput().data().decode()
    if self:
        await self.update_text(message)
@qtinter.asyncslot
async def handle_stderr(self):
    message = self._process.readAllStandardError().data().decode()
    if self:
        await self.update_text(message)


async def run_logcat(self):
    # await self.device.abc_logcat(self.stdout, self.stderr)
    await self.device.abc_logcat()


@qtinter.asyncslot
async def  on_print(self):
    if self.checkBox_Print.checkState() == Qt.Checked:
        self.f=await  aiofiles.open(await self.generateLogFilePath(), 'a+')
        # filter="logcat -b kernel,default |grep TRACE"
        filter = "-b kernel,default"
        self.start_log("adb", ["-s", self.device.serial, "logcat", filter])

    elif self.checkBox_Print.checkState() == Qt.Unchecked:
        self._process.readyReadStandardOutput.disconnect(self.handle_stdout)
        self._process.readyReadStandardError.disconnect(self.handle_stderr)

        # if self.f is not None:
        #     await self.f.close()



def __del__(self):
    if self.f is not None:
        self.f.close()
    self._process.close()

def on_clear_log(self):

    self.plainTextEdit_Log.clear()



async def generateLogFilePath(self):
    await self.parent.log("[+]","生成log文件!")
    currentPath = os.getcwd()
    if not os.path.exists(currentPath+"/logcat"):
        await mkdir(currentPath + "/logcat")
    else:
        pass
    path=os.getcwd()
    now = time.strftime("%Y-%m-%d",time.localtime(time.time()))  
    filename =path+"/logcat/"+self.device.serial+'_'+now+r".txt"          
    # logcat_file =open(filename,'w')
    return filename


@qtinter.asyncslot
async def update_text(self, text):
    if isinstance(text, bytes):
        text = text.decode()
    cursor=None
    if self.checkBox_Scoll.isChecked():  # todo 是否滚动
        cursor = self.plainTextEdit_Log.textCursor()
        cursor.movePosition(QTextCursor.End)

    self.plainTextEdit_Log.appendPlainText(text)
    if self.checkBox_Scoll.isChecked():
        self.plainTextEdit_Log.setTextCursor(cursor)
    self.plainTextEdit_Log.ensureCursorVisible()
    if self.checkBox_SaveFile.isChecked():
        await self.f.write(text)
def closeEvent(self, event):


    self._process.close()
    self._process.terminate()
    event.accept()		

Task exception was never retrieved
future: <Task finished name='Task-4' coro=<LogcatOutputDialog.handle_stdout() done, defined at G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py:54> exception=TypeError("object NoneType can't be used in 'await' expression")>
Traceback (most recent call last):
File "G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py", line 58, in handle_stdout
await self.update_text(message)
TypeError: object NoneType can't be used in 'await' expression
Task exception was never retrieved
future: <Task finished name='Task-6' coro=<LogcatOutputDialog.handle_stdout() done, defined at G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py:54> exception=TypeError("object NoneType can't be used in 'await' expression")>
Traceback (most recent call last):
File "G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py", line 58, in handle_stdout
await self.update_text(message)
TypeError: object NoneType can't be used in 'await' expression
Task exception was never retrieved
future: <Task finished name='Task-8' coro=<LogcatOutputDialog.handle_stdout() done, defined at G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py:54> exception=TypeError("object NoneType can't be used in 'await' expression")>
Traceback (most recent call last):
File "G:\游戏分析\Fuck_linux_kernel\adb_gui_async\ui_component\LogcatOutputDialog.py", line 58, in handle_stdout

tests #78 error

Python-3.9-PySide6-macos-latest

Run python tests/asyncio_tests.py
  python tests/asyncio_tests.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.9.14/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.9.14/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.9.14/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.9.14/x64
    QTINTERBINDING: PySide6
    PYTHONPATH: src

...

======================================================================
ERROR: test_sendfile_fallback_close_peer_in_the_middle_of_receiving (test.test_asyncio.test_sendfile.PollEventLoopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/test/test_asyncio/test_sendfile.py", line 482, in test_sendfile_fallback_close_peer_in_the_middle_of_receiving
    self.run_loop(
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/test/test_asyncio/test_sendfile.py", line 131, in run_loop
    return self.loop.run_until_complete(coro)
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/asyncio/base_events.py", line 647, in run_until_complete
    return future.result()
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/asyncio/base_events.py", line 1171, in sendfile
    return await self._sendfile_fallback(transport, file,
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/asyncio/base_events.py", line 1195, in _sendfile_fallback
    await proto.drain()
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/asyncio/base_events.py", line 231, in drain
    await fut
  File "/Users/runner/hostedtoolcache/Python/3.9.14/x64/lib/python3.9/asyncio/selector_events.py", line 941, in _write_ready
    n = self._sock.send(self._buffer)
OSError: [Errno 41] Protocol wrong type for socket

----------------------------------------------------------------------
Ran 2218 tests in 83.910s

FAILED (errors=1, skipped=77, expected failures=1)
Error: Process completed with exit code 1.

tests #309 error

Python-3.11-PyQt6-macos-latest

Run coverage run -m unittest discover -s tests -v
  coverage run -m unittest discover -s tests -v
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.11.1/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    TEST_QT_MODULE: PyQt6
    PYTHONPATH: src

...

======================================================================
FAIL: test_multiple_senders (test_signal.TestMultiSignal.test_multiple_senders)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/work/qtinter/qtinter/tests/test_signal.py", line 216, in test_multiple_senders
    self.assertEqual(result, [('A', ()), ('A', ()), (4, ())])
AssertionError: Lists differ: [('A', ()), ('A', ()), (4, ()), ('A', ())] != [('A', ()), ('A', ()), (4, ())]

First list contains 1 additional elements.
First extra element 3:
('A', ())

- [('A', ()), ('A', ()), (4, ()), ('A', ())]
?                           -----------

+ [('A', ()), ('A', ()), (4, ())]

----------------------------------------------------------------------
Ran 125 tests in 23.475s

FAILED (failures=1, skipped=10)

Asyncslot eager execution and qtinter.modal

Hi!
Firstly, thanks for the awesome library!

I've noticed that asyncslot and modal might not work correctly all the time. Particularly, when modal is used in the eagerly executed part of an asyncslot.

Environment: Python 3.10.12 (Linux), PySide6 6.5.1.1, qtinter 0.11.0.
I use qtinter.using_asyncio_from_qt().

For example:

# slot is connected via asyncslot
async def on_settings_btn_clicked(self):
    dialog_coro = qtinter.modal(settings_dialog.exec)
    # this call will result in an exception
    result = await dialog_coro()

The exception:

Traceback (most recent call last):
  File "...", line 233, in on_settings_btn_clicked
    result = await dialog_coro()
  File ".../site-packages/qtinter/_modal.py", line 29, in modal_wrapper
    loop.exec_modal(modal_fn)
  File ".../site-packages/qtinter/_base_events.py", line 232, in exec_modal
    raise RuntimeError('QiBaseEventLoop.exec_modal() must be called '
RuntimeError: QiBaseEventLoop.exec_modal() must be called from a coroutine or callback

If I add await asyncio.sleep(0) just before the await of a modal, then everything works fine. Like that:

# slot is connected via asyncslot
async def on_settings_btn_clicked(self):
    dialog_coro = qtinter.modal(settings_dialog.exec)
    await asyncio.sleep(0)
    result = await dialog_coro()

Am I doing something wrong here? What is the best practice for something like this?

@qtinter.asyncslot function can't used in @qtinter.asyncslot function???

[error]

@qtinter.asyncslot
async def on_btnUninstallRefresh_click(self):
self.groupBoxInstall.setEnabled(False)
self.groupBoxUninstall.setEnabled(False)
await self.RefreshInstalledApps()
self.groupBoxInstall.setEnabled(True)
self.groupBoxUninstall.setEnabled(True)
@qtinter.asyncslot
async def on_btnUninstall_click(self):
await self.parent.run_cmd("adb uninstall " + self.comboBoxUninstall.currentText())
await self.RefreshInstalledApps()

@qtinter.asyncslot
async  def RefreshInstalledApps(self):
    self.comboBoxUninstall.clear()
    self.comboBoxUninstall.setEnabled(False)
    text = await self.parent.run_cmd("adb shell pm list packages -3")
    if text != '':
        array = text.split('\n')
        for text2 in array:
            self.comboBoxUninstall.addItem(text2[8:len(text2)])
    # TODO:排序
    if self.comboBoxUninstall.count() > 0:
        self.comboBoxUninstall.setCurrentIndex(0)
    self.comboBoxUninstall.setEnabled(True)

[Ok]

@qtinter.asyncslot
async def on_btnUninstallRefresh_click(self):
    self.groupBoxInstall.setEnabled(False)
    self.groupBoxUninstall.setEnabled(False)
    await self.RefreshInstalledApps()
    self.groupBoxInstall.setEnabled(True)
    self.groupBoxUninstall.setEnabled(True)
@qtinter.asyncslot
async  def on_btnUninstall_click(self):
    await self.parent.run_cmd("adb uninstall " + self.comboBoxUninstall.currentText())
    await self.RefreshInstalledApps()


async  def RefreshInstalledApps(self):
    self.comboBoxUninstall.clear()
    self.comboBoxUninstall.setEnabled(False)
    text = await self.parent.run_cmd("adb shell pm list packages -3")
    if text != '':
        array = text.split('\n')
        for text2 in array:
            self.comboBoxUninstall.addItem(text2[8:len(text2)])
    # TODO:排序
    if self.comboBoxUninstall.count() > 0:
        self.comboBoxUninstall.setCurrentIndex(0)
    self.comboBoxUninstall.setEnabled(True)

tests #296 error

Python-3.11-PySide2-macos-latest

Run python tests/asyncio_tests.py
  python tests/asyncio_tests.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.11.1/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.1/x64
    QTINTERBINDING: PySide2
    PYTHONPATH: src

...

======================================================================
FAIL: test_subprocess_shell (test.test_asyncio.test_events.PollEventLoopTests.test_subprocess_shell)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.11/lib/python3.11/test/test_asyncio/test_events.py", line 1814, in test_subprocess_shell
    self.assertEqual(proto.data[1].rstrip(b'\r\n'), b'Python')
AssertionError: b'' != b'Python'

----------------------------------------------------------------------
Ran 2339 tests in 75.260s

FAILED (failures=1, skipped=80, expected failures=1)
Error: Process completed with exit code 1.

tests #187 error

Python-3.7-PySide6-macos-latest

Run python tests/asyncio_tests.py
  python tests/asyncio_tests.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.7.15/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.7.15/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.15/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.15/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.15/x64
    QTINTERBINDING: PySide6
    PYTHONPATH: src

...

======================================================================
FAIL: test_terminate (test.test_asyncio.test_subprocess.SubprocessSafeWatcherTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.7.15/x64/lib/python3.7/test/test_asyncio/test_subprocess.py", line 185, in test_terminate
    self.assertEqual(-signal.SIGTERM, returncode)
AssertionError: -15 != -9

----------------------------------------------------------------------
Ran 2055 tests in 76.697s

FAILED (failures=1, skipped=37, expected failures=1)
Error: Process completed with exit code 1.

This regression occurs after replacing custom QObject with QTimer in bindings.py.

Types missing

Hi,
I'm confused. When I try to run the example (on macos), it already fails when importing asyncSlot and AsyncSlotRunner.
And in the sources, I can't find such types. What's happen?

tests #68 error

Python-3.7-PySide6-macos-latest

Run python tests/asyncio_tests.py
  python tests/asyncio_tests.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.7.14/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.7.14/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.14/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.14/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.14/x64
    ASYNCSLOT_QTBINDING: PySide6
    PYTHONPATH: src

...

======================================================================
ERROR: test_create_server_ssl_verified (test.test_asyncio.test_events.SelectEventLoopTests)
----------------------------------------------------------------------
Traceback (most recent call last):
  File "/Users/runner/hostedtoolcache/Python/3.7.14/x64/lib/python3.7/test/test_asyncio/test_events.py", line 1235, in test_create_server_ssl_verified
    proto.transport.close()
AttributeError: 'NoneType' object has no attribute 'close'

----------------------------------------------------------------------
Ran 2062 tests in 100.234s

FAILED (errors=1, skipped=37, expected failures=2)
Error: Process completed with exit code 1.

Exception in __del__ for unclosed loop

test_del.py in commit ff64eaf raises the following exception when program exits:

/Users/fancidev/asyncslot/.venv/bin/python /Users/fancidev/asyncslot/test_del.py 
Hi
Bye
sys:1: ResourceWarning: unclosed <socket.socket fd=6, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
sys:1: ResourceWarning: unclosed <socket.socket fd=7, family=AddressFamily.AF_UNIX, type=SocketKind.SOCK_STREAM, proto=0>
ResourceWarning: Enable tracemalloc to get the object allocation traceback
/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py:681: ResourceWarning: unclosed event loop <CustomEventLoop running=False closed=False debug=False>
  _warn(f"unclosed event loop {self!r}", ResourceWarning, source=self)
ResourceWarning: Enable tracemalloc to get the object allocation traceback
Exception ignored in: <function BaseEventLoop.__del__ at 0x7fe3903f44c0>
Traceback (most recent call last):
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/base_events.py", line 683, in __del__
    self.close()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/unix_events.py", line 58, in close
    super().close()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 92, in close
    self._close_self_pipe()
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 99, in _close_self_pipe
    self._remove_reader(self._ssock.fileno())
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/asyncio/selector_events.py", line 277, in _remove_reader
    key = self._selector.get_key(fd)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 191, in get_key
    return mapping[fileobj]
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 72, in __getitem__
    fd = self._selector._fileobj_lookup(fileobj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 226, in _fileobj_lookup
    return _fileobj_to_fd(fileobj)
  File "/Library/Frameworks/Python.framework/Versions/3.9/lib/python3.9/selectors.py", line 42, in _fileobj_to_fd
    raise ValueError("Invalid file descriptor: {}".format(fd))
ValueError: Invalid file descriptor: -1

Process finished with exit code 0

The exception (and ResourceWarning) varies when certain (attribute or method) members of CustomSelector are commented out; the behavior looks random.

No exception is thrown if from PySide6 import QtCore is commented out, or if PySide6 is replaced with PyQt6.

The ResourceWarnings suggest an (unexpected) reference cycle might be introduced when PySide6.QtCore is imported.

A (proper) workaround is to close the loop after use.

System test errors

Use this issue to record errors in the "system test" step in CI testing. These test failures (except those caused by test infrastructure problem) are used to reveal bugs in the Python standard library itself.

qtinter0.8 ,@qtinter.asyncslot function can't used in QMenu??

self.contextMenu = QMenu(self)
self.actionRefresh = QAction("Refresh", self, priority=QAction.LowPriority)
self.actionRefresh.triggered.connect(self.actionRefreshHandler)
self.contextMenu.addAction(self.actionRefresh)

@qtinter.asyncslot
async def  actionRefreshHandler(self):
         pass

can you test this in example?

tests #43 error

Python-3.7-PyQt5-macos-latest

Run coverage run --source=src --append --branch tests/gui_test_clicked.py
  coverage run --source=src --append --branch tests/gui_test_clicked.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.7.13/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.7.13/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.13/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.13/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.7.13/x64
    TEST_QT_MODULE: PyQt5
    PYTHONPATH: src
Traceback (most recent call last):
  File "tests/gui_test_clicked.py", line 27, in <module>
    app.exec()
  File "/Users/runner/work/asyncslot/asyncslot/src/asyncslot/_events.py", line 43, in __exit__
    asyncio.runners._cancel_all_tasks(loop)
  File "/Users/runner/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/runners.py", line 62, in _cancel_all_tasks
    tasks.gather(*to_cancel, loop=loop, return_exceptions=True))
  File "/Users/runner/hostedtoolcache/Python/3.7.13/x64/lib/python3.7/asyncio/base_events.py", line 585, in run_until_complete
Error:     raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
Error: Process completed with exit code 1.

Python-3.11.0-rc.1-PyQt5-macos-latest

Run coverage run --source=src --append --branch tests/gui_test_clicked.py
  coverage run --source=src --append --branch tests/gui_test_clicked.py
  shell: /bin/bash -e {0}
  env:
    pythonLocation: /Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64
    PKG_CONFIG_PATH: /Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64/lib/pkgconfig
    Python_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64
    Python2_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64
    Python3_ROOT_DIR: /Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64
    TEST_QT_MODULE: PyQt5
    PYTHONPATH: src
Traceback (most recent call last):
  File "/Users/runner/work/asyncslot/asyncslot/tests/gui_test_clicked.py", line 25, in <module>
    with AsyncSlotRunner():
  File "/Users/runner/work/asyncslot/asyncslot/src/asyncslot/_events.py", line 43, in __exit__
    asyncio.runners._cancel_all_tasks(loop)
  File "/Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64/lib/python3.11/asyncio/runners.py", line 199, in _cancel_all_tasks
    loop.run_until_complete(tasks.gather(*to_cancel, return_exceptions=True))
  File "/Users/runner/hostedtoolcache/Python/3.11.0-rc.1/x64/lib/python3.11/asyncio/base_events.py", line 648, in run_until_complete
Error:     raise RuntimeError('Event loop stopped before Future completed.')
RuntimeError: Event loop stopped before Future completed.
Error: Process completed with exit code 1.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.