I search for files in a python script and save the files. The problem is that in some cases there are special characters such as ö ä ü inside (UTF-8 table hex U + 00C4 U + 00D6 U + 00DC, etc.) When I print the path with "print", it is displayed correctly. When I use this line to send it to os.system (), special characters are deleted and receive a UTF error.
ErrorMsg:
cp -nv /home/rainer/Arbeitsfläche/Videofiles/A047C001_130226_R1WV.mov /media/rainer/LinuxData
Traceback (most recent call last):
File "Clipfinder.py", line 254, in <module>
copyProcess(sourcedir,destdir,cliplist)
File "Clipfinder.py", line 205, in copyProcess
os.system(copycmd)
UnicodeEncodeError: 'ascii' codec can't encode character u'\xe4' in position 29: ordinal not in range(128)
thanks for the help! Rainer
copycmd = "cp -nv " + pathtoFile_src + " " + destdir
print copycmd
os.system(copycmd)
source
share