Getting the current filename

(rwenzlaff) #1

Under Blender210 module there is a function getFilename().

How do you do that under the current API? Blender210 is no longer available under 2.25.

Actually, I just want the path of the current file, if that’s easier.


(eeshlo) #2

import Blender, os

file = Blender.Get('filename')
t = os.path.split(file)
path = t[0]

or in a single line:

path = os.path.split(Blender.Get('filename'))[0]