Speichern von Datei - Typ Error: 'str' not callable
Verfasst: Samstag 17. Januar 2004, 13:49
Hallo Zusammen,
ich schreibe an einem Skript das html Datein modifiziert und speichert.
Alles klappt bis auf das speichern!!
Ich bekomme stets die Fehlermeldung:
Type Error: 'str' Object is not callable
Auch wenn ich bei der Funktion writeTmpl einfach etwas in einen neue Datei schreibe tritt der Fehler auf?
help very much apprecciated...
Thanks jan
#!/usr/bin/env python
from Cheetah.Template import Template
import old2newDesign
import os
import re
import ki_globals
def writeTmpl(file, input):
file = file('index_print.html','w+')
file.write('<html><head><title>new </title></head><body>')
file.write('</body></html>')
file.close()
html_ending = re.compile('.*\.html?', re.IGNORECASE)
# Walk through directories (begin with directory where script is located)
cwd = os.getcwd()+'/old'
for root, dirs, files in os.walk(cwd):
for file in files:
# Check for html files
if html_ending.search(file) is not None:
os.chdir(root)
print root+'/'+file
input = old2newDesign.html2tmpl(file)
writeTmpl(file,input)
ich schreibe an einem Skript das html Datein modifiziert und speichert.
Alles klappt bis auf das speichern!!
Ich bekomme stets die Fehlermeldung:
Type Error: 'str' Object is not callable
Auch wenn ich bei der Funktion writeTmpl einfach etwas in einen neue Datei schreibe tritt der Fehler auf?
help very much apprecciated...
Thanks jan
#!/usr/bin/env python
from Cheetah.Template import Template
import old2newDesign
import os
import re
import ki_globals
def writeTmpl(file, input):
file = file('index_print.html','w+')
file.write('<html><head><title>new </title></head><body>')
file.write('</body></html>')
file.close()
html_ending = re.compile('.*\.html?', re.IGNORECASE)
# Walk through directories (begin with directory where script is located)
cwd = os.getcwd()+'/old'
for root, dirs, files in os.walk(cwd):
for file in files:
# Check for html files
if html_ending.search(file) is not None:
os.chdir(root)
print root+'/'+file
input = old2newDesign.html2tmpl(file)
writeTmpl(file,input)