Reputation: 27
Right now my code is as follow:
import os
import bpy
path_to_objdir = os.path.join('C:\\','Users\vincent.martel\Documents\Data\full_mesh')
file_list = sorted(os.listdir(path_to_objdir))
obj_list = [item for item in file_list if item.endswith('.obj')]
for item in obj_list:
path_to_file = os.path.join(path_to_objdir, item)
bpy.ops.import_scene.obj(filepath = path_to_file, split_mode = "OFF")
When I run this code, the console outputs an error and highlights the line where I initialize my file_list but does not say anything else (blender console does not even name the error).
Can anyone find a fix?
Upvotes: 2
Views: 1590
Reputation: 16941
Print out the value of your variable path_to_objdir
and copy/paste it into a dir
statement at the Windows console. Does it work? If not, then fix the value so that it does work. I don't have your system so I can't verify this, but the first thing I would try is
path_to_objdir = os.path.join('C:','Users','vincent.martel','Documents','Data','full_mesh')
Upvotes: 2