Here is the code:
import bpy
import csv
import sys
csv_path = sys.argv[1]
file = open(csv_path)
reader = csv.reader(file)
header = next(reader) # 1st line is header
data = [ ]
for row in reader:
name0 = row[0]
name1 = row[0]
pathout = 'test-videos/' + row[5] + '.m4v'
s = bpy.context.scene
f = s.objects['FirstName']
f.data.body = name0
f1 = s.objects['FirstName01']
f1.data.body = name1+'?'
bpy.context.scene.render.filepath = pathout
bpy.ops.render.render(animation=True)
bpy.ops.wm.quit_blender()
And here is the error message:
Read blend: /PI-SAT/proj001/proj001-master.blend
Traceback (most recent call last):
File "/PI-SAT/proj001/proj001master.py", line 9, in <module>
header = next(reader) # 1st line is header
File"/Applications/Blender/blender.app/Contents/Resources/2.79/python/
lib/python3.5/codecs.py", line 321, in decode
(result, consumed) = self._buffer_decode(data, self.errors, final)
UnicodeDecodeError: 'utf-8' codec can't decode byte 0xef in position 23:
invalid continuation byte
Error: File format is not supported in file '/PI-SAT/proj001/test.csv'
... opened default scene instead; saving will write to
/PISAT/proj001/test.csv
I have read the file with a different script using the exact same code as in lines 2 - 15 and then printing the names and pathout. Running the script from the command line, not from within Blender, it works perfectly.
I have also run the part of the script within the for loop outside of the loop as a script from the command line and it works perfectly.
What am I missing about the CSV file? I created it in Excel on my Mac; is that a problem?