小编234*_*DI8的帖子

TypeError:exception必须是旧式类或派生自BaseException,而不是str

以下是我的代码:

test = 'abc'
if True:
    raise test + 'def'
Run Code Online (Sandbox Code Playgroud)

当我运行它时,它给了我 TypeError

TypeError: exceptions must be old-style classes or derived from BaseException, not str
Run Code Online (Sandbox Code Playgroud)

那应该test是什么类型的?

python raise typeerror

43
推荐指数
3
解决办法
6万
查看次数

PyQt4:如何在发出信号之前暂停线程?

我有以下pyqtmain.py:

#!/usr/bin/python3
import sys
from PyQt4.QtCore import *
from PyQt4.QtGui import *
from pyqtMeasThread import *


class MainWindow(QMainWindow):
    def __init__(self, parent=None):
        self.qt_app = QApplication(sys.argv)
        QMainWindow.__init__(self, parent)

        buttonWidget = QWidget()
        rsltLabel = QLabel("Result:")
        self.rsltFiled = QLineEdit()
        self.buttonStart = QPushButton("Start")

        verticalLayout = QVBoxLayout(buttonWidget)
        verticalLayout.addWidget(rsltLabel)
        verticalLayout.addWidget(self.rsltFiled)
        verticalLayout.addWidget(self.buttonStart)

        butDW = QDockWidget("Control", self)
        butDW.setWidget(buttonWidget)
        self.addDockWidget(Qt.LeftDockWidgetArea, butDW)

        self.mthread = QThread()  # New thread to run the Measurement Engine
        self.worker = MeasurementEngine()  # Measurement Engine Object

        self.worker.moveToThread(self.mthread)
        self.mthread.finished.connect(self.worker.deleteLater)  # Cleanup after thread finished

        self.worker.measure_msg.connect(self.showRslt)

        self.buttonStart.clicked.connect(self.worker.run)

        # Everything …
Run Code Online (Sandbox Code Playgroud)

python multithreading interrupt messagebox pyqt4

11
推荐指数
2
解决办法
4912
查看次数

如何使用TortoiseGit为两个GitLab帐户设置两个SSH密钥并推/拉?

目前我使用GitLab作为我的远程GIT服务器.
使用分配了SSH密钥的单个Gitlab帐户我没有问题.

但现在我应用了另一个Gitlab帐户,我正在尝试使用相同的SSH密钥,但我无法将密钥添加到这个新帐户.
当我尝试添加密钥时,错误如下:

钥匙已经被采取
指纹已经采取

那么我应该如何使用相同的密钥访问第二个Gitlab帐户呢?如果不可能,我应该如何同时使用两个键.

顺便说一句,我正在使用Windows系统.

提前致谢!!

================================================== =================更新:

下面是我的配置文件.它如下:

#my primary account
Host {account1}
    User git
    HostName gitlab.com
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa1

#for NPR_HPTG account
Host {account2}
    User git
    HostName gitlab.com
    PreferredAuthentications publickey
    IdentityFile C:/Users/{username}/.ssh/id_rsa2
Run Code Online (Sandbox Code Playgroud)

我有两个Gitlab帐户,

git@gitlab.com:{account_1}/repo1.git
git@gitlab.com:{account_2}/repo1.git
Run Code Online (Sandbox Code Playgroud)

不过,我无法访问account_2.

以前,在我拥有第二个GitLab帐户之前,我只需将ssh密钥上传到account1不需要设置This.但是现在通过这样,仍然,最终我可以推动git@gitlab.com:{account_2}/repo1.git.我正在使用TortoiseGit推/拉.

git ssh key tortoisegit gitlab

5
推荐指数
1
解决办法
1万
查看次数