Warning: file_get_contents(/data/phpspider/zhask/data//catemap/2/python/285.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Python 如何在PyQT网络ftp演示中添加ftp put功能_Python_Ftp_Pyqt_Qtnetwork - Fatal编程技术网

Python 如何在PyQT网络ftp演示中添加ftp put功能

Python 如何在PyQT网络ftp演示中添加ftp put功能,python,ftp,pyqt,qtnetwork,Python,Ftp,Pyqt,Qtnetwork,我想修改pyqt网络ftp演示以包含上载功能,但失败了。有人能告诉我怎么做吗? 我试图添加此代码,但它不起作用。[原始演示] 什么是不工作?你收到错误信息了吗?上传失败了吗?到底发生了什么?@Cyber,没有上传文件,应用程序崩溃了。 buttonBox.addButton(self.uploadButton, QtGui.QDialogButtonBox.ActionRole) self.uploadButton = QtGui.QPushButton("upload"

我想修改pyqt网络ftp演示以包含上载功能,但失败了。有人能告诉我怎么做吗? 我试图添加此代码,但它不起作用。[原始演示]


什么是不工作?你收到错误信息了吗?上传失败了吗?到底发生了什么?@Cyber,没有上传文件,应用程序崩溃了。
buttonBox.addButton(self.uploadButton,
            QtGui.QDialogButtonBox.ActionRole)
self.uploadButton = QtGui.QPushButton("upload")
self.uploadButton.clicked.connect(self.selectFile)

def selectFile(self):
    self.filename =QtGui.QFileDialog.getOpenFileName()
    up_fname = re.sub(r".*/","",self.filename)
    upload_file = QtCore.QFile(self.filename)
    self.ftp.put(upload_file, up_fname)