diesmal versuche ich gerade total verzweifelt eine Datei (hier eine INI-Datei) zu kopieren und an einem belieben Ort einzufügen. Eine Datei von Ort A nach Ort B kopieren. Dazu einen Ausschnitt vom Quelltext:
Code: Alles auswählen
self.ui_pp_NoFileError.pushButtonGo.clicked.connect(self.copy_ini_file)
def copy_ini_file(self):
setting_folder = os.path.abspath(os.path.join('settings', os.linesep))
try:
shutil.copy2(self.inputfile, setting_folder)
except shutil.Error as e:
print('Error: %s' % e)
except IOError as e:
print('Error: %s' % e.strerror)
def load_config_file(self):
self.inputfile = (QFileDialog.getOpenFileName(self, 'Select configuration file',
'',
"configuration files (*.ini)"))
Und bei diesem Versuche bekomme ich folgende Fehlermeldung:
Traceback (most recent call last):
File "D:\Dan\Python\project_xarphus\files\modules_ui\ui_pp_NoFileError.py", line 43, in copy_ini_file
shutil.copy2(self.inputfile, setting_folder)
File "C:\Python27\lib\shutil.py", line 130, in copy2
copyfile(src, dst)
File "C:\Python27\lib\shutil.py", line 68, in copyfile
if _samefile(src, dst):
File "C:\Python27\lib\shutil.py", line 63, in _samefile
return (os.path.normcase(os.path.abspath(src)) ==
File "C:\Python27\lib\ntpath.py", line 471, in abspath
D:\Dan\Python\project_xarphus\settings\
path = _getfullpathname(path)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdc in position 9: ordinal not in range(128)
Traceback (most recent call last):
File "D:\Dan\Python\project_xarphus\files\modules_ui\ui_pp_NoFileError.py", line 43, in copy_ini_file
shutil.copy2(self.inputfile, setting_folder)
File "C:\Python27\lib\shutil.py", line 130, in copy2
copyfile(src, dst)
File "C:\Python27\lib\shutil.py", line 68, in copyfile
if _samefile(src, dst):
File "C:\Python27\lib\shutil.py", line 63, in _samefile
return (os.path.normcase(os.path.abspath(src)) ==
File "C:\Python27\lib\ntpath.py", line 471, in abspath
path = _getfullpathname(path)
UnicodeDecodeError: 'ascii' codec can't decode byte 0xdc in position 9: ordinal not in range(128)