ich habe volgenden einfachen Code:
Code: Alles auswählen
Path2Src = "D:\Allnetic\2012\12\12.csv"
print Path2Src
SrcFil = open(Path2Src, "r")
for line in SrcFil:
#My Actions
SrcFil.close
D:\Allneticチ2
.csv
Traceback (most recent call last):
File "<pyshell#2>", line 1, in <module>
execfile("C:\Users\h11111\Desktop\WT_Email.py")
File "C:\Users\h11111\Desktop\WT_Email.py", line 3, in <module>
SrcFil = open(Path2Src, "r")
IOError: [Errno 22] invalid mode ('r') or filename: 'D:\\Allnetic\x812\n\n.csv'
###############################################################################
Ganz oben ist der Output vom print Teil, der Path String ist offensichtlich nicht richtig im Python angekommen. Aber alle Symbole sind richtig, ich benutzte keine speziellen symbole. Danach kommt der Error beim open command, da der String schlecht ist, wird der File nicht geoffnet.
Ich habe versucht die lokation zu verändern, C disk, D disk .. ist das selbe. Hat jemand eine Ahnung wieso der Path String deformiert wird?