# Script for export vertex in CSV dont work

I'm quite new in the blender and many things I do not understand yet. I would like to extract the coordinates of each vertex in CSV Well... I'm trying to use this script, but I can not make it work, supposedly copying / pasting it and pressing the "run" button should work, but there's no way.

Surely it is a very basic question, but the truth is, I have no idea.

I do not even know how to write the code correctly on this page :( (but I just found out ^^ )

import bpy

outputFile = 'C:/someFolder/mesh.csv'

verts = [ bpy.context.object.matrix_world * v.co for v in bpy.context.object.data.vertices ]

csvLines = [ ";".join([ str(v) for v in co ]) + "\n" for co in verts ]

f = open( outputFile, 'w' )
f.writelines( csvLines )
f.close()


It always gives the same error in line #9 :

Thanks for reading this, any help will be very grateful. A greeting!

• There seems to be nothing wrong with the script. I could run it just by pasting it in the text window. (It may have got something to do with the outputFile string.) To find the exact error run blender from console. On windows from start menu, click run then cmd. Go to blender dir 'cd <dir_name>' and execute blender. If you run the script now you should see the exact error message on the console. And keep coding, blender is such fun :) – Blender Dadaist Sep 11 '18 at 4:53
• You can also toggle on the correct error console, see blender.stackexchange.com/questions/97976/… – Sazerac Sep 11 '18 at 4:54