以下是我的代码:
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是什么类型的?
我有以下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) 目前我使用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推/拉.